Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Sullivan <andrew(at)libertyrms(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Date: 2002-10-04 05:03:13
Message-ID: 1033707793.722.963.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

On Fri, 2002-10-04 at 01:41, Bruce Momjian wrote:
> Well, let's see what others say. If no one is excited about the change,
> we can just document its current behavior. Oh, I see it is already
> documented in func.sgml:
>
> It is quite important to realize that
> <function>CURRENT_TIMESTAMP</function> and related functions all return
> the time as of the start of the current transaction; their values do not
> increment while a transaction is running. But
> <function>timeofday()</function> returns the actual current time.
>
> Seems that isn't helping enough to reduce the number of people who are
> surprised by our behavior. I don't think anyone would be surprised by
> statement time.
>
> What do others think?

I would prefer that CURRENT_TIME[STAMP] always produce the same time
within a transaction. If it is changed, it will certainly break one of
my applications, which explicitly depends on the current behaviour. If
you change it, please provide an alternative way of doing the same
thing.

I can see that the current behaviour might give surprising results in a
long running transaction. Surprise could be reduced by giving the time
of first use within the transaction rather than the start of the
transaction.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"For the word of God is quick, and powerful, and
sharper than any twoedged sword, piercing even to the
dividing asunder of soul and spirit, and of the joints
and marrow, and is a discerner of the thoughts and
intents of the heart." Hebrews 4:12

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-10-04 05:20:55 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Previous Message Jeff Post 2002-10-04 03:55:07 Re: to_char(0,'FM999.99') outputs 0.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-10-04 05:20:55 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Previous Message Tom Lane 2002-10-04 04:53:15 Re: Return of INSTEAD rules

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-10-04 05:20:55 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Previous Message Tom Lane 2002-10-04 03:14:43 Re: order by x DESC, y ASC indexing problem