Bug #7806 insert on duplicate key and auto-update of timestamp
Submitted: 11 Jan 2005 15:45 Modified: 27 Apr 2005 1:43
Reporter: Olaf van der Spek (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.11 OS:Any (*)
Assigned to: Ingo Strüwing CPU Architecture:Any

[11 Jan 2005 15:45] Olaf van der Spek
Description:
In the fifth query, the (first) timestamp field is automatically updated, although the c = c should prevent that, just like it does in the fourth query.
The timestamps in row 2 and 3 should be equal.

Output:
INSERT INTO `t` VALUES (1, 0, '0000-00-00 00:00:00');
INSERT INTO `t` VALUES (2, 2, '0000-00-00 00:00:00');
INSERT INTO `t` VALUES (3, 3, '2005-01-11 16:41:34');

How to repeat:
drop table if exists t;
create table t (a int auto_increment primary key, b int, c timestamp);
insert into t (a, b, c) values (1, 0, 0), (2, 0, 0), (3, 0, 0);
update t set b = 2, c = c where a = 2;
insert into t (a) values (3) on duplicate key update b = 3, c = c;
[8 Feb 2005 12:22] Ingo Strüwing
The server did not notice that one of the fields in the ON DUPLICATE KEY UPDATE clause was the timestamp field. So it continued to update it automatically.
I added a check and disabled the automatic in this situation.
The changeset is:
bk commit - 4.1 tree (ingo:1.2175) BUG#7806
Date: 	Mon, 07 Feb 2005 22:51:55 +0100
[26 Feb 2005 16:35] Olaf van der Spek
> Patch pending (2 days)

What does the 2 days mean?
I thought the patch was uploaded weeks ago.
[2 Mar 2005 10:32] Ingo Strüwing
I guess, the number referes to the last modification of the buf report, including comments like this one.
[22 Mar 2005 7:51] Ingo Strüwing
The patch was rejected.
[8 Apr 2005 11:34] Olaf van der Spek
Will you write another patch?
[8 Apr 2005 12:06] Ingo Strüwing
Sure, it is still "in progress". Unfortunately I have three bugs with higher priority currently.
[15 Apr 2005 19:18] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24061
[19 Apr 2005 13:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24143
[22 Apr 2005 10:30] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24220
[27 Apr 2005 1:43] Paul DuBois
Noted in 4.1.12 changelog.