Bug #669 | Bug on update with 2 timestamp(14) fields | ||
---|---|---|---|
Submitted: | 18 Jun 2003 5:39 | Modified: | 18 Jun 2003 5:54 |
Reporter: | biloo1 biloo1 | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Command-line Clients | Severity: | S2 (Serious) |
Version: | 3.23.56 | OS: | Windows (windows 2000) |
Assigned to: | CPU Architecture: | Any |
[18 Jun 2003 5:39]
biloo1 biloo1
[18 Jun 2003 5:54]
Guilhem Bichot
Hi, you just have to read our manual about this: <quote> 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. Automatic updating of the first TIMESTAMP column occurs under any of the following conditions: * The column is not specified explicitly in an INSERT or LOAD DATA INFILE statement. * The column is not specified explicitly in an UPDATE statement and some other column changes value. (Note that an UPDATE that sets a column to the value it already has will not cause the TIMESTAMP column to be updated, because if you set a column to its current value, MySQL ignores the update for efficiency.) * You explicitly set the TIMESTAMP column to NULL. TIMESTAMP columns other than the first may also be set to the current date and time. Just set the column to NULL or to NOW(). </quote> When you update the 2nd timestamp to NOW(), it gets updated to NOW(). As the row is being updated, this triggers the updating of the first timestamp, to NOW() as well. I'm not sure you need 2 TIMESTAMP columns. Maybe one TIMESTAMP and one DATETIME? Bye (Bien le bonjour chez toi!).