From: Samuel Stearns <SStearns@internode.com.au>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: transaction_timestamp()
Date: Wed, 26 May 2010 08:39:41 +0930
Message-ID: <68B59BEDCD36854AADBDF17E91B2937A01A57CCDFF@EXCHMAIL.staff.internode.com.au> (raw)
In-Reply-To: <4BFBC5B90200002500031A5E@gw.wicourts.gov>
References: <68B59BEDCD36854AADBDF17E91B2937A01A57CCCB9@EXCHMAIL.staff.internode.com.au>
<17418.1274761902@sss.pgh.pa.us>
<68B59BEDCD36854AADBDF17E91B2937A01A57CCD01@EXCHMAIL.staff.internode.com.au>
<4BFBC5B90200002500031A5E@gw.wicourts.gov>
Hi Tom and Kevin,
I stand corrected. It was awhile ago that I last played around with this. I must have had the DELETE operation outside the transaction block back then possibly.
Thanks for setting me straight. Sorry about the waste of time.
Sam
-----Original Message-----
From: Kevin Grittner [mailto:Kevin.Grittner@wicourts.gov]
Sent: Wednesday, 26 May 2010 3:13 AM
To: Samuel Stearns
Cc: pgsql-admin@postgresql.org; Tom Lane
Subject: Re: [ADMIN] transaction_timestamp()
Samuel Stearns <SStearns@internode.com.au> wrote:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> transaction_timestamp() is exactly the same thing as now().
> I got into trouble using now() before.
Using what? What kind of trouble?
> Transaction_timestamp() is really what I need, I think.
test=# \x
Expanded display is on.
test=# begin;
BEGIN
test=# select now(), current_timestamp, transaction_timestamp();
-[ RECORD 1 ]---------+------------------------------
now | 2010-05-25 12:41:34.365224-05
now | 2010-05-25 12:41:34.365224-05
transaction_timestamp | 2010-05-25 12:41:34.365224-05
[wait ten seconds or so...]
test=# select now(), current_timestamp, transaction_timestamp();
-[ RECORD 1 ]---------+------------------------------
now | 2010-05-25 12:41:34.365224-05
now | 2010-05-25 12:41:34.365224-05
transaction_timestamp | 2010-05-25 12:41:34.365224-05
test=# commit;
COMMIT
test=# select now(), current_timestamp, transaction_timestamp();
-[ RECORD 1 ]---------+------------------------------
now | 2010-05-25 12:41:50.765224-05
now | 2010-05-25 12:41:50.765224-05
transaction_timestamp | 2010-05-25 12:41:50.765224-05
> BEGIN;
> INSERT INTO blah_archive (id, user) SELECT id, user FROM blah
> where date < (now() - '30 days'::interval);
> DELETE FROM blah where date < (now() - '30 days'::interval);
> END;
>
> The now() on the INSERT will be a different time than the now() on
> the DELETE
What makes you think that?
-Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: SStearns@internode.com.au, Kevin.Grittner@wicourts.gov, tgl@sss.pgh.pa.us
Subject: Re: transaction_timestamp()
In-Reply-To: <68B59BEDCD36854AADBDF17E91B2937A01A57CCDFF@EXCHMAIL.staff.internode.com.au>
References: <68B59BEDCD36854AADBDF17E91B2937A01A57CCCB9@EXCHMAIL.staff.internode.com.au> <17418.1274761902@sss.pgh.pa.us> <68B59BEDCD36854AADBDF17E91B2937A01A57CCD01@EXCHMAIL.staff.internode.com.au> <4BFBC5B90200002500031A5E@gw.wicourts.gov> <68B59BEDCD36854AADBDF17E91B2937A01A57CCDFF@EXCHMAIL.staff.internode.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox