Transactions and timestamps
If I do
BEGIN
UPDATE some_session set time_stop = CURRENT_TIMESTAMP
UPDATE another_session set time_start = CURRENT_TIMESTAMP
END
Is there any chance the current_timestamp will be different?
Do I have to first select current_timestamp and then update with a variable? (function?)
---
Daniel Åkerud
[ Don't underestimate the power of stupid people in large groups]
Please don't post HTML to the mailing list - it makes quoting difficult...
From: "Daniel �kerud" <zilch@home.se>
If I do
BEGIN
UPDATE some_session set time_stop = CURRENT_TIMESTAMP
UPDATE another_session set time_start = CURRENT_TIMESTAMP
END
Is there any chance the current_timestamp will be different?
=reply=
If you try your example by hand (with a suitable pause) you'll see
CURRENT_TIMESTAMP and the now() function return the time at the start of the
transaction. You use timeofday() IIRC to get the "real" current time.
HTH
- Richard Huxton
=?iso-8859-1?Q?Daniel_=C5kerud?= <zilch@home.se> writes:
If I do
BEGIN
UPDATE some_session set time_stop =3D CURRENT_TIMESTAMP
UPDATE another_session set time_start =3D CURRENT_TIMESTAMP
END
Is there any chance the current_timestamp will be different?
No. CURRENT_TIMESTAMP is actually the time of the start of the
transaction.
regards, tom lane