Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Sullivan <andrew(at)libertyrms(dot)info>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Date: 2002-10-03 22:15:59
Message-ID: 200210032215.g93MFx823428@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

Andrew Sullivan wrote:
> On Thu, Oct 03, 2002 at 04:18:08PM -0400, Bruce Momjian wrote:
> >
> > So, we have a couple of decisions to make:
> >
> > Should CURRENT_TIMESTAMP be changed to "statement arrival time"?
> > Should now() be changed the same way?
> > If not, should now() and CURRENT_TIMESTAMP return the same type of
> > value?
> >
> > One idea is to change CURRENT_TIMESTAMP to "statement arrival time", and
> > leave now() as transaction start time.
>
> A disadvantage to this, as I see it, is that users may have depended on
> the traditional Postgres behavior of time "freezing" in transaction.
> You always had to select timeofday() for moving time. I can see an
> advantage in making what Postgres does somewhat more like what other
> people do (as flat-out silly as some of that seems to be). Still, it
> looks to me like the present CURRENT_TIMESTAMP implementation is at
> least as much like the spec as anyone else's implementation, and more
> like the spec than many of them. So I'm still not clear on what
> problem the change is going to fix, especially since it breaks with
> traditional behavior.

Uh, why change? Well, we have a "tradition" issue here, and changing it
will require something in the release notes. The big reason to change
is that most people using CURRENT_TIMESTAMP are not anticipating that it
is transaction start time, and are asking/complaining. We had one only
this week. If it were obvious to users when they used it, we could just
say it is our way of doing it, but in most cases it is catching people
by surprised. Given that other DB's have CURRENT_TIMESTAMP changing
even more frequently than we think is reasonable, it would make sense to
change it so it more closely matches what people expect, both new SQL
users and users moving from other DBs.

So, in summary, reasons for the change:

more intuitive
more standard-compliant
more closely matches other db's

Reasons not to change:

PostgreSQL traditional behavior

Does that help?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-10-03 23:09:33 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Previous Message Charles H. Woloszynski 2002-10-03 22:12:53 Re: Restoring databases using only data/ dir

Browse pgsql-hackers by date

  From Date Subject
Next Message Curtis Faith 2002-10-03 22:17:55 Re: Advice: Where could I be of help?
Previous Message Andrew Sullivan 2002-10-03 22:03:19 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-10-03 23:09:33 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Previous Message Andrew Sullivan 2002-10-03 22:03:19 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP