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: | Alvin Xu | 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]
Alvin Xu
[10 Feb 2012 6:39]
Valeriy Kravchuk
Please, send the output of: select @@sql_mode; from your environment.
[10 Feb 2012 6:46]
Alvin Xu
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]
Alvin Xu
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.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.