Thread: timestamp and time now support precision

timestamp and time now support precision

From
Thomas Lockhart
Date:
I've implemented timestamp and time precision per SQL99 spec. The syntax
is
 TIMESTAMP(2) WITH TIME ZONE
or TIME(0)
etc etc.

One result of this is that "timestamp" is no longer a valid external
function name (among other things) due to parser ambiguity between
 TIMESTAMP(2)

and, say,
 TIMESTAMP(date 'today')

(the latter used to be supported). If you need to explicitly call a
function by that name you need to surround the function name with double
quotes, as in
 select "timestamp"(date 'today');

All regression tests pass, though we will probably need updates to the
"pre-1970" regression results. The CVS notes follow...
                       - Thomas

Implement precision support for timestamp and time, both with and
without time zones. 
SQL99 spec requires a default of zero (round to seconds) which is set in
gram.y as typmod is set in the parse tree. We *could* change to a
default of either 6 (for internal compatibility with previous versions)
or 2 (for external compatibility with previous versions).
Evaluate entries in pg_proc wrt the iscachable attribute for timestamp
and other date/time types. Try to recognize cases where side effects
like the current time zone setting may have an effect on results to
decide whether something is cachable or not.