Bug with multiple timestamp fields in a single row.

Bug #28358 reported by M Litherland
6
Affects Status Importance Assigned to Milestone
mysql-dfsg-4.1 (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

If there are multiple Timestamp columns in a table, if the second or subsequent
timestamp is updated, the first one is also updated. Please see for yourself:

mysql> create table testing (
    -> id int(10) not null auto_increment,
    -> t1 timestamp not null,
    -> t2 timestamp not null,
    -> primary key (`id`)
    -> ) engine=MyISAM;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into testing (t1, t2) values ('1970-01-01 00:00:00', '1970-01-01
00:00:00');
Query OK, 1 row affected (0.00 sec)

mysql> select * from testing;
+----+----------------+----------------+
| id | t1 | t2 |
+----+----------------+----------------+
| 1 | 19700101000000 | 19700101000000 |
+----+----------------+----------------+
1 row in set (0.00 sec)

mysql> update testing set t2='2006-01-10 16:41:00' where id=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from testing;
+----+----------------+----------------+
| id | t1 | t2 |
+----+----------------+----------------+
| 1 | 20060110164157 | 20060110164100 |
+----+----------------+----------------+
1 row in set (0.00 sec)

I can't believe that this is the correct behavior.

Thanks!
Mike

http://nule.org: http://nule.org

Revision history for this message
Alan Tam (at) wrote :

According to documentation http://dev.mysql.com/doc/refman/4.1/en/timestamp-4-1.html
only one timestamp field will be updated, and you can choose which one to.

Changed in mysql-dfsg-4.1:
status: Unconfirmed → Rejected
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.