List:General Discussion« Previous MessageNext Message »
From:Jonathan Mangin Date:April 2 2006 2:43pm
Subject:Re: TIMESTAMP field not automatically updating last_updated field
View as plain text  
----- Original Message ----- 
From: "Ferindo Middleton Jr" <fmiddleton@stripped>
To: "Ferindo Middleton Jr" <fmiddleton@stripped>
Cc: "Hank" <heskin@stripped>; <mysql@stripped>
Sent: Friday, March 31, 2006 7:30 PM
Subject: Re: TIMESTAMP field not automatically updating last_updated field


> Ferindo Middleton Jr wrote:
> > Hank wrote:
> >> Are the other fields in the update statement actually changing the
> >> data? I don't know for sure, but if the data on disk is the same as
> >> the update statement, mysql won't actually update the record, and
> >> therefore might not update the last_updated field also.  Just a
> >> thought.
> >>
> >>   
> > Yes, I understand that one concept. I have seen it before.... If you 
> > do an update on a record but the actually values that you are passing 
> > in the statement are the exact values as were there before, no update 
> > to the timestamp field is made because none of the records values 
> > actually changed....
> >
> > But no, that is not my situation. I've tested it.... and I am actually 
> > changing the values in the table (of course not specifying a new value 
> > for the TIMESTAMP field) but still the TIMESTAMP field doesn't 
> > auto-update.
> >
> > What disturbes me is that  it works fine in one particular  table but 
> > all the others it works.
> >
> > Ferindo
> >
> I'm running 5.0.19-nt. I haven't had a chance to test it but should  it 
> make any difference if I say:
> 
>      last_updated TIMESTAMP,
> 
> than if I say all this:
> 
> last_updated    TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
> 
> I think this may be the difference in why some tables are auto 
> incrementing and others aren't.
> 
> Ferindo
> 
I'm using 4.1.11 on Solaris.  I've explicitly created a table
with one timestamp field and
DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL

I haven't tried an explicit update (useless to me) but an
insert...on duplicate key update does not update the timestamp
field.

Have you, Ferindo, had any success yet?  Does anyone have any
further thoughts?  (I just realized I need this also)

--Jon

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