List:General Discussion« Previous MessageNext Message »
From:mwexler@tias.com (Mike Wexler) Date:April 2 1999 7:24pm
Subject:Re: TIMESTAMP changes when no other fields have change
View as plain text  
From section 7.2.6.2 of the mysql manual:

	The column is not specified explicitly in an UPDATE statement 
	and some other column changes value. (Note that an UPDATE that 
	sets a column to the value it already has will not cause the 
	TIMESTAMP column to be updated, because if you set a column 
	to its current value, MySQL ignores the update for efficiency.) 

> On Fri, 2 Apr 1999 09:48:05 -0800, Mike Wexler wrote:
> 
> >	INSERT INTO myTable(value, id) VALUES ("my value", "myKey");
> >	SELECT stamp FROM myTable WHERE id="myKey";
> >
> >	# Time consuming operation here
> >
> >	UPDATE myTable SET value="my value" WHERE id="myKey";
> >	SELECT stamp FROM myTable WHERE id="myKey";
> 
> Why do you call this a bug? You are clearly updating the record, even
> though you're putting in a value that happens to be the same as the one
> that was there. There is no reason for the SQL server to look at
> "value" in the record to satisfy your request. It simply finds records
> matching the WHERE part and places "my value" into the field "value".
> 
> If you want the time stamp updated only on change, you need to do a
> SELECT, identify the records where you want to change, and then change
> only those.
> 
> 
> -Sincerely, Fred
> 
> (Frederik Lindberg, Infectious Diseases, WashU, St. Louis, MO, USA)
> 
> 
> 
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread1329@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
TIMESTAMP changes when no other fields have changeMike Wexler2 Apr
Re: TIMESTAMP changes when no other fields have changeFred Lindberg2 Apr
  • Re: TIMESTAMP changes when no other fields have changeMike Wexler)2 Apr
  • Re: TIMESTAMP changes when no other fields have changePaul DuBois2 Apr
    • Re: TIMESTAMP changes when no other fields have changeMichael Widenius3 Apr