pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Neil Conway <neilc@samurai.com>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Brendan Jurd <direvus@gmail.com>
Cc: pgsql-patches@postgresql.org
Subject: Re: Additional current timestamp values
Date: Mon, 20 Mar 2006 18:05:02 -0500
Message-ID: <441F351E.8030203@samurai.com> (raw)
In-Reply-To: <200603202234.k2KMYOM04077@candle.pha.pa.us>
References: <200603202234.k2KMYOM04077@candle.pha.pa.us>

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



view thread (21+ messages)  latest in thread

Message-ID: <441F351E.8030203@samurai.com>
Permalink:  ../441F351E.8030203@samurai.com/
Also on:    postgresql.org/message-id/441F351E.8030203@samurai.com

 · 

reply

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-hackers@postgresql.org
  Cc: neilc@samurai.com, pgman@candle.pha.pa.us, direvus@gmail.com, pgsql-patches@postgresql.org
  Subject: Re: Additional current timestamp values
  In-Reply-To: <441F351E.8030203@samurai.com>
  References: <200603202234.k2KMYOM04077@candle.pha.pa.us> <441F351E.8030203@samurai.com>

* 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