Re: [SQL] CURRENT_TIMESTAMP

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: josh(at)agliodbs(dot)com, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Manfred Koizar <mkoi-pg(at)aon(dot)at>, Roland Roberts <roland(at)astrofoto(dot)org>, pgsql-sql(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [SQL] CURRENT_TIMESTAMP
Date: 2002-09-30 04:36:34
Message-ID: 14905.1033360594@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Now, they are _not_ saying the statement can't have the same time as
> other statements in the transaction, but I don't see why they would
> explicitly have to state that.

Allow me to turn that around: given that they clearly do NOT state that,
how can you argue that "the spec requires it"? AFAICS the spec does not
require it. In most places they are considerably more explicit than
this about stating what is required.

> We already have two other databases who are doing this timing at
> statement level.

The behavior of CURRENT_TIMESTAMP is clearly stated by the spec to be
implementation-dependent. We are under no compulsion to follow any
specific other implementation. If we were going to follow some other
lead, I'd look to Oracle first...

> If we change CURRENT_TIMESTAMP to statement time, I don't think we need
> now(""), but if we don't change it, I think we do --- somehow we should
> allow users to access statement time.

I have no problem with providing a function to access statement time,
and now('something') seems a reasonable spelling of that function.
But I think the argument that we should change our historical behavior
of CURRENT_TIMESTAMP is very weak.

One reason why I have a problem with the notion that the spec requires
CURRENT_TIMESTAMP to mean "time of arrival of the current interactive
command" (which is the only specific definition I've seen mentioned
here) is that the spec does not truly have a notion of interactive
command to begin with. AFAICT the spec's model of command execution
is ecpg-like: you have commands embedded in a calling language with
all sorts of opportunities for pre-planning, pre-execution, etc.
The notion of command arrival time is extremely fuzzy in this model.
It could very well be the time you compiled the ecpg application, or
the time you started the application running.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guido Staub 2002-09-30 09:44:17 current_timestamp after queries
Previous Message Tom Lane 2002-09-30 03:53:59 Re: [SQL] CURRENT_TIMESTAMP

Browse pgsql-hackers by date

  From Date Subject
Next Message Steve King 2002-09-30 08:14:00 Bad rules
Previous Message Tom Lane 2002-09-30 04:20:02 Re: Do we want a CVS branch now?

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2002-09-30 12:29:26 Re: [SQL] arrays
Previous Message Tom Lane 2002-09-30 03:53:59 Re: [SQL] CURRENT_TIMESTAMP