List:General Discussion« Previous MessageNext Message »
From:Fred Lindberg Date:April 2 1999 6:32pm
Subject:Re: TIMESTAMP changes when no other fields have change
View as plain text  
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)


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