Read the section in the manual about timestamps, this is expected behavior,
it is how it is supposed to work.

http://www.mysql.com/doc/en/DATETIME.html
The TIMESTAMP column type provides a type that you can use to automatically
mark INSERT or UPDATE operations with the current date and time. If you have
multiple TIMESTAMP columns, only the first one is updated automatically...

-----Original Message-----
From: Marco Deppe [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 3:18 AM
To: [EMAIL PROTECTED]
Subject: TIMESTAMP field is updated unintentionally


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


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to