Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Date: 2002-10-03 20:18:08
Message-ID: 200210032018.g93KI8110524@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql


[ Thread moved to hackers.]

OK, I have enough information from the various other databases to make a
proposal. It seems the other databases, particularly Oracle, record
CURRENT_TIMESTAMP as the time of statement start. However, it isn't the
time of statement start from the user's perspective, but rather from the
database's perspective, i.e. if you call a function that has two
statements in it, each statement could have a different
CURRENT_TIMESTAMP.

I don't think that is standards-compliant, and I don't think any of our
users want that. What they probably want is to have a fixed
CURRENT_TIMESTAMP from the time the query is submitted until it is
completed. We can call that the "statement arrival time" version of
CURRENT_TIMESTAMP. I don't know if any of the other databases support
this concept, but it seems the most useful, and is closer to the
standards and to other databases than we are now.

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.

Also, should we added now("val") where val can be "transaction",
"statement", or "clock"?

--
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 Tino Wildenhain 2002-10-03 20:35:08 Re: [HACKERS] Anyone want to assist with the
Previous Message Tom Lane 2002-10-03 20:07:50 Re: Restoring databases using only data/ dir

Browse pgsql-hackers by date

  From Date Subject
Next Message Tino Wildenhain 2002-10-03 20:35:08 Re: [HACKERS] Anyone want to assist with the
Previous Message Tom Lane 2002-10-03 20:00:32 Re: DROP COLUMN misbehaviour with multiple inheritance

Browse pgsql-sql by date

  From Date Subject
Next Message Ron Johnson 2002-10-03 20:55:35 Re: [HACKERS] Large databases, performance
Previous Message Edoardo Causarano 2002-10-03 19:34:24 Rule creation