Re: Additional current timestamp values

From: Neil Conway <neilc(at)samurai(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Brendan Jurd <direvus(at)gmail(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Additional current timestamp values
Date: 2006-03-20 23:05:02
Message-ID: 441F351E.8030203@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:
> <function>CURRENT_TIMESTAMP</> might not be the
> transaction start time on other database systems.
> For this reason, and for completeness,
> <function>transaction_timestamp</> is provided.

Well, transaction_timestamp() is even more unlikely to be the
transaction start time on other database systems :) If the user wants
non-standard syntax for getting the timestamp at which the current
transaction began, we already have now().

> One trick is that these should be the same:
>
> test=> SELECT statement_timestamp(), transaction_timestamp();

Should they be? It seems quite reasonable to me that the DBMS begins a
transaction internally (setting transaction_timestamp()), and then a
short while later begins executing the statement submitted by the user,
at which point statement_timestamp() is set.

Perhaps ensuring they are identical for single-statement transactions is
the best behavior, I just don't think this is required behavior.

> And these should be the same:
>
> $ psql -c '
> INSERT INTO t VALUES (statement_timestamp());
> INSERT INTO t VALUES (statement_timestamp());' test
> INSERT 0 1

Uh, why should these be the same?

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2006-03-20 23:13:45 Re: Additional current timestamp values
Previous Message Bruce Momjian 2006-03-20 23:02:06 Re: Additional current timestamp values

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-03-20 23:13:10 Re: Removal of backward-compatibility docs mentions
Previous Message Bruce Momjian 2006-03-20 23:03:10 Re: Removal of backward-compatibility docs mentions