Re: Use of 'now'

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: Thomas Lockhart <lockhart(at)fourpalms(dot)org>, PostgreSQL-documentation <pgsql-docs(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use of 'now'
Date: 2001-11-14 03:58:48
Message-ID: 200111140358.fAE3wmY23341@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> >> Nothing of interest anymore, since 'current' has been removed as of 7.2.
> >> However, Thomas has yet to commit any docs updates for his recent
> >> datetime-related changes ... including that one ...
>
> > Seems it is still in there somewhere:
>
> > test=> create table bb (x timestamp default 'current', y int);
>
> Hmm. It was *supposed* to be removed entirely, but possibly what
> Thomas actually did was to continue to accept the keyword as equivalent
> to 'now'. Thomas?

[ CC'ing to hackers because this is getting into code problems. ]

Here's another inconsistency that Tatsuo found:

test=> create table ff (x time default 'current_timestamp');
ERROR: Bad time external representation 'current_timestamp'
test=> create table ff (x time default 'current');
ERROR: Bad time external representation 'current'
test=> create table ff (x time default 'now');
CREATE
test=> select current_timestamp;
timestamptz
-------------------------------
2001-11-13 22:49:50.607401-05
(1 row)

You can default a time to now, but not to current or current_timestamp.

I believe this is happening because current is implemented as special
timezones in datetime.c and timestamp.c, and current_timestamp is
implemented in gram.y, while 'now' is a function.

Anyway, looks like confusion that should be fixed.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Thomas Lockhart 2001-11-14 07:08:34 Re: Use of 'now'
Previous Message Bruce Momjian 2001-11-14 03:40:13 Re: Use of 'now'

Browse pgsql-hackers by date

  From Date Subject
Next Message Ivan Babikov 2001-11-14 05:59:56 Is there an API reference for Postgres? What about 2-phase transactions?
Previous Message Bruce Momjian 2001-11-14 03:40:13 Re: Use of 'now'