Hi,

> I have a table whose schema contains:
> id INTEGER AUTO_INCREMENT,
> gen_time TIMESTAMP,
> rec_time TIMESTAMP,
> repeats INTEGER DEFAULT 0,
> PRIMARY KEY (id),
> INDEX (rec_time))
>
> When I do an:
> UPDATE table SET repeats=repeats+1
>
> gen_time gets updated as well:

[snip]

> mysql> select id, gen_time, rec_time, repeats from table;
> +----+----------------+----------------+---------+
> | id | gen_time       | rec_time       | repeats |
> +----+----------------+----------------+---------+
> |  1 | 20020405112158 | 20020405111308 |       3 |
> +----+----------------+----------------+---------+
> 1 row in set (0.02 sec)
>
> Is this a bug or am I forgetting something?

Are you expecting the second timestamp column in your table to be updated
whenever you change a record? If so, I'm afraid you're outta luck. May I
quote from the manual:

"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."

That last sentence may be of particular interest...

So, to summarise, you do not have a bug.

Regards,

Basil Hussain
---------------------------------------
Internet Developer, Kodak Weddings
E-Mail: [EMAIL PROTECTED]



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