Re: Need timestamp function that will change within a transaction

From: Steve Atkins <steve(at)blighty(dot)com>
To: Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Need timestamp function that will change within a transaction
Date: 2008-05-14 20:01:07
Message-ID: 2A9D160B-A5C2-43BE-9B8E-DC34BD256FD4@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 14, 2008, at 12:56 PM, D. Dante Lorenso wrote:

> I'd like to find a timestamp function that WILL change within a
> transaction.
>
> This function will return to me a 15 digit BIGINT number in base10:
>
> SELECT FLOOR(EXTRACT(EPOCH FROM NOW()) * 100000)::bigint;
>
> The problem is that NOW() does not change within a transaction and
> so I keep getting the same value. Is there a function that will
> return a timestamp that is NOT consistent within a transaction?

Take a look at statement_timestamp() or clock_timestamp()

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andy Anderson 2008-05-14 20:02:32 Re: rounding problems
Previous Message D. Dante Lorenso 2008-05-14 19:56:42 Need timestamp function that will change within a transaction