Bug #2464 Wrong value produced by DEFAULT keyword for 2nd TIMESTAMP column
Submitted: 20 Jan 2004 10:11 Modified: 30 Jan 2004 8:29
Reporter: Dmitry Lenev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:bk-4.0 OS:Any (all)
Assigned to: Dmitry Lenev CPU Architecture:Any

[20 Jan 2004 10:11] Dmitry Lenev
Description:
Wrong value is inserted then DEFAULT keyword is used as field value 
for second timestamp column in table. 
The value should be same as if we don't specify this field in field list of INSERT statement.

How to repeat:
mysql> create table testts (ts1 timestamp, ts2 timestamp);
Query OK, 0 rows affected (0.03 sec)

mysql> insert into testts values ();
Query OK, 1 row affected (0.01 sec)

mysql> select * from testts;
+----------------+----------------+
| ts1            | ts2            |
+----------------+----------------+
| 20040120205006 | 00000000000000 |
+----------------+----------------+
1 row in set (0.01 sec)

mysql> insert into testts values (DEFAULT,DEFAULT);
Query OK, 1 row affected (0.00 sec)

mysql> select * from testts;
+----------------+----------------+
| ts1            | ts2            |
+----------------+----------------+
| 20040120205006 | 00000000000000 |
| 20040120205024 | 20040120205024 |
+----------------+----------------+
2 rows in set (0.00 sec)

mysql> 

Suggested fix:
Fix Field_timestamp::set_default() method.
[30 Jan 2004 8:29] Dmitry Lenev
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

ChangeSet 1.1683.6.1 2004/01/30 15:13:19 dlenev@mysql.com
  Fix for bugs #1885, #2464, #2539. Proper handling of default
  values for TIMESTAMP columns.