Bug #64290 | INSERT ON DUPLICATE KEY UPDATE can't work with primary key value equals zero | ||
---|---|---|---|
Submitted: | 10 Feb 2012 6:24 | Modified: | 10 Feb 2012 15:41 |
Reporter: | xu qing | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 5.5.15 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | insert on duplicate key update |
[10 Feb 2012 6:24]
xu qing
[10 Feb 2012 6:39]
Valeriy Kravchuk
Please, send the output of: select @@sql_mode; from your environment.
[10 Feb 2012 6:46]
xu qing
The result of SELECT @@SQL_MODE; mysql> select @@sql_mode; +------------+ | @@sql_mode | +------------+ | | +------------+ 1 row in set (0.00 sec)
[10 Feb 2012 7:14]
Valeriy Kravchuk
Please, execute: set session sql_mode='NO_AUTO_VALUE_ON_ZERO'; and then try your test again. Read http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html#sqlmode_no_auto_value_on_zero for the details.
[10 Feb 2012 7:43]
xu qing
It works.
[10 Feb 2012 10:44]
Peter Laursen
Still a bug IMHO. An existing row is specified to be updated, but it is not. Peter (not a MySQL person)
[10 Feb 2012 15:41]
Valeriy Kravchuk
Depending on SQL mode value 0 inserted into auto_increment column either generates new row with next auto incremented value every time, or inserts row with value 0 literally. I do not see any bug here with both cases.