[KLUG Members] MySQL weirdness ...

bill bill at billtron.com
Thu Oct 13 16:09:29 EDT 2005


On Thu, 2005-10-13 at 14:07, Bruce Smith wrote:

> 
> This is the part that I'm still a little confused.
> 
> There are 2 TIMESTAMP fields in the record, starttime and endtime.
> starttime is part of the primary key (as you know), endtime is not part
> of any unique key.  Both are type TIMESTAMP's - I triple checked!  :-)
> 
> After my first UPDATE statement, the starttime field IS reset to the
> current date/time.  HOWEVER, endtime is left unchanged!  Why???

Only the first timestamp field is auto-updated on a record change.

Note also the default for endtime is zeros.

> mysql> describe recorded;
> +-------------+------------------+------+-----+---------------------+-------+
> | Field       | Type             | Null | Key | Default             | Extra |
> +-------------+------------------+------+-----+---------------------+-------+
> | chanid      | int(10) unsigned |      | PRI | 0                   |       |
> | starttime   | timestamp        | YES  | PRI | CURRENT_TIMESTAMP   |       |
> | endtime     | timestamp        | YES  | MUL | 0000-00-00 00:00:00 |       |




More information about the Members mailing list