List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 31 2003 7:38pm
Subject:Re: TIMESTAMP field is updated unintentionally
View as plain text  
At 12:17 +0100 1/31/03, Marco Deppe wrote:
>Hi,
>
>I was already questioning my sanity,

Don't.  Reading the manual is more helpful. :-)

>  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?

What does the manual say?

>
>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?

According to the manual, that's how it's supposed to work.
Visit the online manual and type TIMESTAMP into the search box.
It'll give you the answers you're looking for.

>(mysql  Ver 11.18 Distrib 3.23.51, for pc-linux-gnu (i686))
>
>
>
>--
>Best regards,
>Marco
>
>mailto:MarcoDeppe@stripped

Thread
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