List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:May 6 1999 8:24pm
Subject:Re: TIMESTAMP bug?
View as plain text  
Daevid Vincent wrote:

> I don't know if this is a bug or the way the TIMESTAMP is supposed to work, but
> I felt it worthy of bringing to someone's attention:
>
> I had this in a table:
>   date TIMESTAMP(14) NOT NULL,     # date of insert or last update
> (YYYYMMDDHHMMSS)
>
> This was used as the date the record was created, and was to stay the same always.
>
> It did that.
> UPDATES were NOT changing this field's value and I was passing in null during the
> INSERT
>
> Later I created a second column via ALTER TABLE:
>   last_update TIMESTAMP(14) NOT NULL,
>
> which was supposed to be used to monitor the last updates of the record.
> Upon any "UPDATE" SQL call, I would explicitly say, "last_update = null".
>
> An odd thing started to occur. All my "date" columns were then updating as well!
> SO both columns had the same stamp in them.
> For shits and giggles, I removed the "last_update = null" in my UPDATEs, and
> then "date" started to automatically change.... grrr.
>
> I later noticed in the documentation that TIMESTAMP should be changing upon ANY
> INSERT or UPDATE
> (which again, it hadn't been until this scenario and I didn't want it to do unless
> I passed in a null explicitly during an UPDATE).
>
> mysql  Ver 9.31 Distrib 3.22.20a, for pc-linux-gnu (i686)

I didn't see a reply to this one yet, and was wondering if it was indeed a bug or
something known already or just something I possibly did wrong?

Thread
TIMESTAMP bug in 3.22.20a/linux? and DATETIME question.Daevid Vincent4 May
  • Re: TIMESTAMP bug in 3.22.20a/linux? and DATETIME question.johan.engstrom4 May
  • Re: TIMESTAMP bug?Daevid Vincent7 May
  • Re: TIMESTAMP bug?Fred Read7 May