List:General Discussion« Previous MessageNext Message »
From:Scott Haneda Date:March 31 2006 1:24am
Subject:Re: TIMESTAMP field not automatically updating last_updated field
View as plain text  
> I think I've seen this complaint posted before but I ignored but now I
> realize that in some of my db tables' last_updated field the value is
> automatically updating on UPDATEs to records while in other tables the
> last_updated fields for some strange reason aren't automatically updating.
> 
> I'll usually use the following line in my table declarations:
> 
> last_updated  TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
> 
> In some tables it automatically updates on subsequent updates to the
> table and in others it will not. The purpose here is to have the
> last_updated field automatically append to the current timestamp... the
> application on the front end doesn't specify the time to MySQL but
> rather expects that it's always going to be UPDATEd to the current time
> slot.
> 
> What am I doing wrong what command should I issue to my tables to
> correct it? Thanks

What veriosn of mysql, timestamp handling has changed from one version to
the next?

Perhaps you have others in your table, I think only the first is updated, at
least, in pre 4.1 days, after that, check the docs for the correct behavior.
-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.


Thread
TIMESTAMP field not automatically updating last_updated fieldFerindo Middleton Jr31 Mar
  • Re: TIMESTAMP field not automatically updating last_updated fieldScott Haneda31 Mar
  • Re: TIMESTAMP field not automatically updating last_updated fieldjonathan31 Mar
    • Re: TIMESTAMP field not automatically updating last_updated fieldFerindo Middleton Jr31 Mar
      • Re: TIMESTAMP field not automatically updating last_updated fieldHank31 Mar
        • Re: TIMESTAMP field not automatically updating last_updated fieldBarry31 Mar
        • Re: TIMESTAMP field not automatically updating last_updated fieldFerindo Middleton Jr1 Apr
          • Re: TIMESTAMP field not automatically updating last_updated fieldFerindo Middleton Jr1 Apr
  • Re: TIMESTAMP field not automatically updating last_updated fieldJonathan Mangin2 Apr