Bug with ON DUPLICATE KEY UPDATE and bulk insert in MySQL-4.1
am 05.12.2002 01:50:39 von Jocelyn FournierHi,
How-to-repeat :
CREATE TABLE `searchjoinhardwarefr8` (
`topic` mediumint(8) unsigned NOT NULL default '0',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`pseudo` char(35) character set latin1 NOT NULL default '',
`numreponse` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`date`,`numreponse`,`topic`),
UNIQUE KEY `pseudo` (`pseudo`,`date`,`numreponse`,`topic`),
UNIQUE KEY `numreponse` (`numreponse`),
KEY `topic` (`topic`)
) TYPE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO searchjoinhardwarefr8 VALUES (0, '0000-00-00 00:00:00', '',
2788),
(0, '0000-00-00 00:00:00', '', 2789),
(0, '0000-00-00 00:00:00', '', 2815);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> SELECT * FROM searchjoinhardwarefr8;
+-------+---------------------+--------+------------+
| topic | date | pseudo | numreponse |
+-------+---------------------+--------+------------+
| 0 | 0000-00-00 00:00:00 | | 2788 |
| 0 | 0000-00-00 00:00:00 | | 2789 |
| 0 | 0000-00-00 00:00:00 | | 2815 |
+-------+---------------------+--------+------------+
3 rows in set (0.00 sec)
INSERT INTO searchjoinhardwarefr8 VALUES (0, '0000-00-00 00:00:00', '',
2788),
(0, '0000-00-00 00:00:00', '', 2789),
(0, '0000-00-00 00:00:00', '1', 2816) ON DUPLICATE KEY UPDATE topic=topic+1;
Query OK, 5 rows affected (0.00 sec)
Records: 3 Duplicates: 2 Warnings: 0
mysql> SELECT * FROM searchjoinhardwarefr8;
+-------+---------------------+--------+------------+
| topic | date | pseudo | numreponse |
+-------+---------------------+--------+------------+
| 0 | 0000-00-00 00:00:00 | 1 | 2788 |
| 0 | 0000-00-00 00:00:00 | 1 | 2789 |
| 0 | 0000-00-00 00:00:00 | 1 | 2815 |
| 0 | 0000-00-00 00:00:00 | 1 | 2816 |
+-------+---------------------+--------+------------+
4 rows in set (0.00 sec)
=> topic has not been incremented, and moreover pseudo has been updated to 1
for all the rows ??
UPDATE : I'm unable to reproduce this bug now with the same testcase ?! I've
just checked again my first the result into mysql-monitor, and there is no
error...
I don't understand exactly what's going on. Could it be possible the query
cache be implicated in this problem ?
Regards,
Jocelyn
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread13203@lists.mysql.com
To unsubscribe, e-mail