Re: Transactions and timestamps

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: Daniel Åkerud <zilch(at)home(dot)se>, "PostgreSQL-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Transactions and timestamps
Date: 2001-08-07 15:32:29
Message-ID: 006a01c11f56$2cd6aec0$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Please don't post HTML to the mailing list - it makes quoting difficult...

From: "Daniel Åkerud" <zilch(at)home(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sue Lane 2001-08-07 15:37:01 Re: Database handle destroyed without explicit disconnect
Previous Message Nicholas Piper 2001-08-07 15:30:07 Another seq scan instead of index question