Bug #28867 INSERT ...ON DUPLICATE KEY UPDATE,affected_rows diff between 5.0.18 and 5.0.41
Submitted: 4 Jun 2007 7:45 Modified: 4 Jun 2007 8:29
Reporter: Chunping Ruan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.41 OS:FreeBSD (6.2 amd64)
Assigned to: CPU Architecture:Any
Tags: UPDATE DUPLICATE affected_rows

[4 Jun 2007 7:45] Chunping Ruan
Description:
CREATE TABLE  `ttt` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `xx` int(10) unsigned NOT NULL,
  `v` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `Index_2` (`xx`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

INSERT INTO ttt (xx,v) VALUES (1,3);
INSERT INTO ttt
(xx,v) VALUES
(1,5)
ON DUPLICATE KEY UPDATE
v=v;

in  5.0.18 the affected_rows is 2
and 5.0.41 the affected_rows is 0

(MyISAM and InnoDB have the same problem)

Is it a bug or a new feature of the 5.0.41 version?

my application code is based on 5.0.18,if this is not a bug,i must change a lot of my code to fix this problem :(

How to repeat:
CREATE TABLE  `ttt` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `xx` int(10) unsigned NOT NULL,
  `v` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `Index_2` (`xx`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

INSERT INTO ttt (xx,v) VALUES (1,3);
INSERT INTO ttt
(xx,v) VALUES
(1,5)
ON DUPLICATE KEY UPDATE
v=v;
[4 Jun 2007 8:19] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

This change is result of fix of bug #19978. See bug description and commit log at http://lists.mysql.com/commits/19450
[4 Jun 2007 8:29] Chunping Ruan
Thank Sveta Smirnova!

i will fix my code :)