pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manfred Koizar <mkoi-pg@aon.at>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Aaron Held <aaron@MetroNY.com>
Cc: Roberto Mello <rmello@cc.usu.edu>
Cc: Neil Conway <neilc@samurai.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-general@postgresql.org
Subject: Re: [SQL] CURRENT_TIMESTAMP
Date: Mon, 23 Sep 2002 21:02:00 +0200
Message-ID: <kgmuouku2imliobrrck45ugkc0hlrkbo1v@4ax.com> (raw)
In-Reply-To: <22827.1032800742@sss.pgh.pa.us>
References: <21724.1032793386@sss.pgh.pa.us>
	<200209231506.g8NF6JP13779@candle.pha.pa.us>
	<0meuousc373fdokv3bbke116jsbkpakno2@4ax.com>
	<22827.1032800742@sss.pgh.pa.us>

On Mon, 23 Sep 2002 13:05:42 -0400, Tom Lane <tgl@sss.pgh.pa.us>
wrote:
>Manfred Koizar <mkoi-pg@aon.at> writes:
>> This has been discussed before and I know I'm going to get flamed for
>> this, but IMHO having now() (which is a synonym for CURRENT_TIMESTAMP)
>> return the start time of the current transaction is a bug, or at least
>> it is not conforming to the standard.
>
>As you say, it's been discussed before.

Yes, and I hate to be annoying.

>We concluded that the spec defines the behavior as
>implementation-dependent,

AFAICT the spec requires the returned value to meet two conditions.

C1: If a statement contains more than one <datetime value function>,
they all have to return (maybe different formats of) the same value.

C2: The returned value has to represent a point in time *during* the
execution of the SQL-statement.

The only thing an implementor is free to choose is which point in time
"during the execution of the SQL-statement" is to be returned, i.e. a
timestamp in the interval between the start of the statement and the
first time when the value is needed.

The current implementation only conforms to C1.

>and therefore we can pretty much do what we want.

Start time of the statement, ... of the transaction, ... of the
session, ... of the postmaster, ... of the century?

I understand that with subselects, functions, triggers, rules etc. it
is not easy to implement the specification.  If we can't do it now, we
should at least add a todo and make clear in the documentation that
CURRENT_DATE/TIME/TIMESTAMP is not SQL92/99 compliant.

Servus
 Manfred



view thread (61+ messages)  latest in thread

Message-ID: <kgmuouku2imliobrrck45ugkc0hlrkbo1v@4ax.com>
Permalink:  ../kgmuouku2imliobrrck45ugkc0hlrkbo1v@4ax.com/
Also on:    postgresql.org/message-id/kgmuouku2imliobrrck45ugkc0hlrkbo1v@4ax.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mkoi-pg@aon.at, tgl@sss.pgh.pa.us, pgman@candle.pha.pa.us, aaron@MetroNY.com, rmello@cc.usu.edu, neilc@samurai.com, pgsql-general@postgresql.org
  Subject: Re: [SQL] CURRENT_TIMESTAMP
  In-Reply-To: <kgmuouku2imliobrrck45ugkc0hlrkbo1v@4ax.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