List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:February 1 2003 12:23am
Subject:Re: TIMESTAMP field is updated unintentionally
View as plain text  
At 12:17 PM +0100 1/31/03, Marco Deppe wrote:
>I was already questioning my sanity, but the problem below is
>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
>     -> 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))


Automatic updating of the first TIMESTAMP column occurs under any of 
the following conditions:


# You explicitly set the TIMESTAMP column to NULL that means it's a feature.


| Steve Edberg                                      sbedberg@stripped |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin      |
| SETI@Home: 1001 Work units on 23 oct 2002                              |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
TIMESTAMP field is updated unintentionallyMarco Deppe31 Jan
  • Re: TIMESTAMP field is updated unintentionallyJoseph Bueno31 Jan
  • RE: TIMESTAMP field is updated unintentionallyJennifer Goodie31 Jan
  • Re: TIMESTAMP field is updated unintentionallyiConnect \(Berlin\) Stefan Hinz31 Jan
  • Re: TIMESTAMP field is updated unintentionallyPaul DuBois31 Jan
  • Re: TIMESTAMP field is updated unintentionallygerald_clark31 Jan
  • Re: TIMESTAMP field is updated unintentionallyBenjamin Pflugmann31 Jan
  • Re: TIMESTAMP field is updated unintentionallySteve Edberg1 Feb
RE: TIMESTAMP field is updated unintentionallyPeter Grigor31 Jan