Bug #27582 INSERT ... ON DUPLICATE KEY - rows affected incorrect - again!
Submitted: 2 Apr 2007 8:05 Modified: 2 Apr 2007 9:04
Reporter: Corin Langosch Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Packaging Severity:S1 (Critical)
Version:5.0.37 OS:
Assigned to: CPU Architecture:Any

[2 Apr 2007 8:05] Corin Langosch
Description:
please see bug 19978 too

How to repeat:
CREATE TABLE `webcams` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `owner_id` int(10) unsigned NOT NULL default '0',
  `last_online` int(10) unsigned NOT NULL default '0',
  `num_online` int(10) unsigned NOT NULL default '0',
  `descr` varchar(200) collate latin1_german1_ci NOT NULL default '',
  `last_ip` varchar(15) collate latin1_german1_ci NOT NULL default '',
  `last_port` int(10) unsigned NOT NULL default '0',
  `last_width` smallint(5) unsigned NOT NULL default '0',
  `last_height` smallint(5) unsigned NOT NULL default '0',
  `online` tinyint(3) unsigned NOT NULL default '0',
  `active` tinyint(3) unsigned NOT NULL default '0',
  `pass` varchar(20) collate latin1_german1_ci NOT NULL default '',
  `local_ip` varchar(15) collate latin1_german1_ci NOT NULL default '',
  `skey` varchar(32) collate latin1_german1_ci NOT NULL default '',
  `mkey` varchar(32) collate latin1_german1_ci NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `owner_id` (`owner_id`),
  KEY `online` (`online`),
  KEY `combo4` (`active`,`online`,`last_online`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci AUTO_INCREMENT=3 ;

INSERT INTO webcams SET owner_id=1,active='1',descr='super cam!!',pass='test' ON DUPLICATE KEY UPDATE owner_id=1,active='1',descr='super cam!!',pass='test',online=online+10
affected rows: 1

INSERT INTO webcams SET owner_id=1,active='1',descr='super cam!!',pass='test' ON DUPLICATE KEY UPDATE owner_id=1,active='1',descr='super cam!!',pass='test',online=online+10
affected rows: 0 (should be 2!!!)

Suggested fix:
revert fix or fix the fix of bug 19978 ;)
[2 Apr 2007 9:04] Sveta Smirnova
Thank you for the report.

I can not repeat it with current sources. Seems you have to wait next community release.