Allow quoted values in mysql integer columns?
Consider the table schema for table1:
id: int country_id: int description: varchar(50)
and the query:
INSERT INTO table1(id, country_id, description) VALUES (1, '20', 'Test Desc');
This would work under MySQL 4x but will fail under MySQL 5x (ERROR 1067 (42000): Invalid default value for .. ").
I know the reason for this to happen - country_id is int and therefore should not be quoted. Is there a mysql switch under 5x somewhere to make it behave like 4x so the query won't fail?
I've inherited an applicat开发者_如何学运维ion that uses queries like this and I'm looking for a quick fix until I can find the time to fix all the queries.
Thank you
There is no problem with '20'. MySql (5.x) also casts '20' to 20 and => this is a valid insert
精彩评论