Bug #40124 TIMESTAMP in 5.0 behaves like in 4.0
Submitted: 18 Oct 2008 8:28 Modified: 18 Oct 2008 8:46
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Data Types Severity:S2 (Serious)
Version:5.0.51, 5.0.67 OS:Any
Assigned to: CPU Architecture:Any

[18 Oct 2008 8:28] Peter Laursen
Description:
I experience that one the first TIMESTAMP in a table definition an "ON UPDATE CURRENT_TIMESTAMP" takes effect *implicitly*.  There is no such clause in table definition!

For TIMESTAMP *not first* in a table definition an no such implicit "ON UPDATE CURRENT_TIMESTAMP" happens.

How to repeat:
CREATE TABLE `timestamptable1` (
`TextField` varchar(20) NOT NULL,
`LastUpdate` timestamp NOT NULL,
`DateCreated` timestamp 
) ENGINE=InnoDB;

CREATE TABLE `timestamptable2` (
`TextField` varchar(20) NOT NULL,
`DateCreated` timestamp, 
`LastUpdate` timestamp NOT NULL
) ENGINE=InnoDB;

insert into timestamptable1 set TextField="Original Text", Datecreated = CURRENT_TIMESTAMP;
insert into timestamptable2 set TextField="Original Text", Datecreated = CURRENT_TIMESTAMP;

select * from timestamptable1;
/*
TextField               LastUpdate        DateCreated  
-------------  -------------------  -------------------
Original Text  2008-10-18 10:15:02  2008-10-18 10:15:02
*/

select * from timestamptable2;
/*
TextField              DateCreated         LastUpdate  
-------------  -------------------  -------------------
Original Text  2008-10-18 10:15:54  0000-00-00 00:00:00
*/

update timestamptable1 set TextField="Revised Text";
update timestamptable2 set TextField="Revised Text";

select * from timestamptable1;
/*
TextField              LastUpdate        DateCreated  
------------  -------------------  -------------------
Revised Text  2008-10-18 10:19:10  2008-10-18 10:15:02
*/

select * from timestamptable2;
/*
TextField             DateCreated         LastUpdate  
------------  -------------------  -------------------
Revised Text  2008-10-18 10:19:14  0000-00-00 00:00:00
*/

Suggested fix:
To mee this looks like TIMESTAMP behaviour of 3.x and 4.0.

Is it intentional and documented like this?  To me this looks like a regression in code!
[18 Oct 2008 8:46] Peter Laursen
my mistake ..

I confused two tables with a NULL and NOT NULL timestamp! :(