Re: timestamp default values - Mailing list pgsql-general

From Tom Lane
Subject Re: timestamp default values
Date
Msg-id 29097.1123388760@sss.pgh.pa.us
Whole thread Raw
In response to Re: timestamp default values  (Brendan Jurd <direvus@gmail.com>)
Responses Re: timestamp default values  (Brendan Jurd <direvus@gmail.com>)
List pgsql-general
Brendan Jurd <direvus@gmail.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

pgsql-general by date:

Previous
From: Brendan Jurd
Date:
Subject: Re: timestamp default values
Next
From: Brendan Jurd
Date:
Subject: Re: timestamp default values