List:General Discussion« Previous MessageNext Message »
From:Jay Miller Date:June 4 1999 3:39pm
Subject:FW: update & timestamp - bug or feature?
View as plain text  
While I think the original message here was a off base calling the behaviour
of TIMESTAMP buggy, I do think it it would be nice to be able to have a
column whose DEFAULT was set to NOW().  Nearly all of my pre-MySQL tables
have a DateCreated column and a LastModified column.  While I can obviously
modify any INSERT statements to insert NOW() into DateCreated, I would like
to be able to set the DEFAULT for a column to a non-constant value.  It
seems that being able to use a function for a default value wouldn't be too
hard.

Just something to consider,
Jay

> -----Original Message-----
> From: Paul DuBois [mailto:paul@stripped]
> Sent: Friday, June 04, 1999 9:07 AM
> To: Davor Cengija; Paul DuBois
> Cc: Davor Cengija; mysql@stripped
> Subject: Re: update & timestamp - bug or feature?
>
>
> At 12:38 AM -0500 6/4/99, Davor Cengija wrote:
> >On Thu, 3 Jun 1999, Paul DuBois wrote:
> >
> >>At 3:00 PM -0500 6/3/99, Davor Cengija wrote:
> >
> >>>update my_table set some_value = 'other word' where id = .whatever.;
> >>>
> >>>       causes the some_value to change, of course, AND ts (timestamp
> >>>       column) is updated as well, so it has the time when the row
> >>>       was updated, not inserted (what i'd expect).
> >>>
> >>>       so, is it a bug od feature?
> >>
> >>Well, what you're observing is how it's documented to work, so I guess
> >>I'd say "feature".
> >>
> >>
> >>>       to avoid this problem, i'm using
> >>>
> >>>update my_table set some_value = 'other word', ts = ts where id =
> >>>.whatever.;
> >>>
> >>>       as mentioned in the manual under Update.
> >>
> >>
> >>Now you know why it says that in the manual. :-)
> >
> >       hehehe... put it in the manual and it becomes a feature:-)
>
> That's preferable to not documenting it, isn't it?
>
> >       however, i wrote the previous mail considering that 'feature'
> >       a little bit 'wrong', and therefore considering it 'buggy'...
>
> Why do you consider it so?  Just curious.
>
> You can get the behavior you want with a DATETIME column instead, that you
> set to NOW() when you create a record and leave alone thereafter.  I'm not
> sure I see the problem.
>
> --
> Paul DuBois, paul@stripped
> Northern League Chronicles: http://www.snake.net/nl/
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread4537@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.
>
>

Thread
FW: update & timestamp - bug or feature?Jay Miller4 Jun
  • FW: update & timestamp - bug or feature?Michael Widenius5 Jun