At 12:17 PM +0100 1/31/03, Marco Deppe wrote:
>Hi,
>
>I was already questioning my sanity, but the problem below is
>reproduceable:
>
>This is how my table looks:
>mysql> describe T_ORDH;
>--------------+----------------------+-----+----+--------+--------
>Field |Type |Null |Key |Default |Extra
>--------------+----------------------+-----+----+--------+--------
>PK_ID |int(10) unsigned | |PRI |NULL |auto_inc
>ERSTELL_DATUM |timestamp(14) |YES | |NULL |
>STATUS |smallint(5) unsigned | | |0 |
>
>If I do
>mysql> update T_ORDH set STATUS=2 where PK_ID=26272;
>ERSTELL_DATUM is set to the current date. I know that a timestamp
>takes the current time, if set it to NULL, but since I'm not touching
>it, it shouldn't change, should it?
>
>A quick workaround is
>mysql> update T_ORDH set STATUS=2, ERSTELL_DATUM=ERSTELL_DATUM
> -> where PK_ID=26272;
>
>The big question: Is it a bug or a feature?
>(mysql Ver 11.18 Distrib 3.23.51, for pc-linux-gnu (i686))
From:
http://www.mysql.com/doc/en/DATETIME.html
Automatic updating of the first TIMESTAMP column occurs under any of
the following conditions:
<snip>
# You explicitly set the TIMESTAMP column to NULL
...so that means it's a feature.
-steve
--
+------------------------------------------------------------------------+
| Steve Edberg sbedberg@stripped |
| University of California, Davis (530)754-9127 |
| Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| SETI@Home: 1001 Work units on 23 oct 2002 |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens... |
+------------------------------------------------------------------------+