Bug #28446 wrong affected rows when using insert into ... on duplicate key ...
| Submitted: | 15 May 2007 14:51 | Modified: | 16 May 2007 12:44 |
|---|---|---|---|
| Reporter: | Corin Langosch | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S1 (Critical) |
| Version: | 5.0.41 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | affected rows, insert into ... on duplicate key ... | ||
[15 May 2007 14:59]
Corin Langosch
just discovered, and i think these bugs are related: when executing: INSERT IGNORE INTO user_infos SET user_id=1,mails=1,book='1',gtag=1,foto_comment='0',blog_comment='1',buchung='1',i_mail=4,i_buddy=11,i_tele=5,i_lchat=10,i_close='0',events='1'; affected_rows is 2. i think it should be 0 (because a value with same primary is existing). when a new row is instered, it should be 1. but it should NEVER be 2 here?!!
[15 May 2007 15:33]
Corin Langosch
sorry, it turned out to be a bug in php's mysqli (not mysql) extensionn. please close, thank's.
[16 May 2007 12:44]
Heikki Tuuri
Closed by user request.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 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.
Description: affected rows is always 2, no matter wether a new row has been inserted, updated or nothing happened at all (because stored data == update data) How to repeat: CREATE TABLE `user_infos` ( `user_id` int(10) unsigned NOT NULL, `mails` tinyint(4) NOT NULL, `mails_trigger` enum('0','1') collate latin1_german1_ci NOT NULL, `book` enum('0','1') collate latin1_german1_ci NOT NULL, `gtag` tinyint(4) NOT NULL, `foto_comment` enum('0','1') collate latin1_german1_ci NOT NULL, `buchung` enum('0','1') collate latin1_german1_ci NOT NULL, `blog_comment` enum('0','1') collate latin1_german1_ci NOT NULL, `i_mail` tinyint(4) NOT NULL, `i_buddy` tinyint(4) NOT NULL, `i_tele` tinyint(3) unsigned NOT NULL, `i_lchat` tinyint(3) unsigned NOT NULL, `i_close` enum('0','1') collate latin1_german1_ci NOT NULL, `max_fotoalben` tinyint(3) unsigned NOT NULL, `max_fotoalben_fotos` int(10) unsigned NOT NULL, `events` enum('0','1') collate latin1_german1_ci NOT NULL, `contacts_look` enum('text','images') collate latin1_german1_ci NOT NULL default 'images', PRIMARY KEY (`user_id`), KEY `trigger_mails` (`mails_trigger`,`mails`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci; insert into user_infos set user_id=1,mails=1,book='1',gtag=1,foto_comment='0',blog_comment='1',buchung='1',i_mail=4,i_buddy=11,i_tele=5,i_lchat=10,i_close='0',events='1' on duplicate key update user_id=1,mails=1,book='1',gtag=1,foto_comment='0',blog_comment='1',buchung='1',i_mail=4,i_buddy=11,i_tele=5,i_lchat=10,i_close='0',events='1'; affected rows: 2 (should be 1) insert into user_infos set user_id=1,mails=1,book='1',gtag=1,foto_comment='0',blog_comment='1',buchung='1',i_mail=4,i_buddy=11,i_tele=5,i_lchat=10,i_close='0',events='1' on duplicate key update user_id=1,mails=1,book='1',gtag=1,foto_comment='0',blog_comment='1',buchung='1',i_mail=4,i_buddy=11,i_tele=5,i_lchat=10,i_close='0',events='1'; affected rows: 2 (should be 2) insert into user_infos set user_id=1,mails=1,book='1',gtag=1,foto_comment='0',blog_comment='1',buchung='1',i_mail=4,i_buddy=11,i_tele=5,i_lchat=10,i_close='0',events='1' on duplicate key update user_id=1,mails=1,book='1',gtag=1,foto_comment='0',blog_comment='1',buchung='1',i_mail=4,i_buddy=11,i_tele=5,i_lchat=10,i_close='0',events='1'; affected rows: 2 (should be 0)