Re: timestamp default values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: timestamp default values
Date: 2005-08-07 04:26:00
Message-ID: 29097.1123388760@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Brendan Jurd <direvus(at)gmail(dot)com> writes:
> Does anybody know why this function returns text? The documentation
> cites "historical reasons". Are any of those historical reasons still
> relevant?

Backwards compatibility --- changing the result datatype would
surely break some applications. I'm a tad worried even about changing
the output format, but we can probably get away with that, especially
if we do it as part of a new release. (Back-patching such a change
seems like a no-no.)

There has been some talk of bypassing this problem by inventing a whole
new function with a different name, but no one's put up a proposal that
garnered enough support. (I seem to recall a tentative consensus on
inventing a single function that would take an argument to say whether
you wanted transaction start time, statement start time, or true current
time --- but that fell apart when it was pointed out that we would have
to label such a function volatile, thereby making it unindexable. We
really need to use differently-named functions for these things.)

> Or perhaps I could add an optional precision parameter to timenow(),
> so you could call timenow(6) and achieve the same thing.

I'd be interested to see how you do that, considering that abstime
can't store fractional seconds. timenow() is even more obsolete than
timeofday() --- AFAICS it's not documented at all, anywhere. The whole
abstime datatype is obsolete, actually, and will have to go away
sometime before 2038.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brendan Jurd 2005-08-07 04:41:22 Re: timestamp default values
Previous Message Brendan Jurd 2005-08-07 03:59:13 Re: timestamp default values