Guess you still missed this line:

- If you have multiple TIMESTAMP columns, only the first one is updated
- automatically.

Your example explicitly sets the first one to an empty string and doesn't
set the second, so both get 000...

Michael

On Thu, 7 Mar 2002, Shankar Unni wrote:

> Paul DuBois wrote:
>
>  > Feature you missed.  Have a look here:
>  >
>  > http://www.mysql.com/doc/D/A/DATETIME.html
>
> Thanks. I wonder how I missed that.
>
> Of course, the page lies somewhat: it says that if you omit the column in
> an insert, it should get set to now(), but the following example shows it
> doesn't - notice that "u" is omitted in the insert, but gets set to 0
> instead of now().
>
> >>    create table foo (t timestamp, u timestamp);
> >>    insert into foo(t) values('');
> >>     // inserts 0000.... in both t and u.
>
>
> Not that I want to get into an "aha! Gotcha!" thing, of course.
>
> P.S. The reason I went with TIMESTAMP instead of DATETIME is for storage
> efficiency (I'm logging millions of events into a table), but at the same
> time, I'm logging different kinds of events to the table, and some have
> additional timestamps that are only applicable for those variants (which is
> why I would like to set the column to NULL for the other cases).
>
> Anyway, sigh!.
>
> Thanks,
> --
> Shankar.

Michael Stassen
University Information Technology Services
Indiana University Bloomington
[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