Adjust the parser to accept the typename syntax INTERVAL ... SECOND(n)
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Sep 2008 15:27:30 +0000 (15:27 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Sep 2008 15:27:30 +0000 (15:27 +0000)
commitd1e3db873b4c2f309f7f9baa11074c12a9b60dba
treee6e4337136c759946c7bf89617038d37505e8d4f
parentd5e063c97dbecc96c37ef05eb836392f04ee6709
Adjust the parser to accept the typename syntax INTERVAL ... SECOND(n)
and the literal syntax INTERVAL 'string' ... SECOND(n), as required by the
SQL standard.  Our old syntax put (n) directly after INTERVAL, which was
a mistake, but will still be accepted for backward compatibility as well
as symmetry with the TIMESTAMP cases.

Change intervaltypmodout to show it in the spec's way, too.  (This could
potentially affect clients, if there are any that analyze the typmod of an
INTERVAL in any detail.)

Also fix interval input to handle 'min:sec.frac' properly; I had overlooked
this case in my previous patch.

Document the use of the interval fields qualifier, which up to now we had
never mentioned in the docs.  (I think the omission was intentional because
it didn't work per spec; but it does now, or at least close enough to be
credible.)
doc/src/sgml/datatype.sgml
src/backend/parser/gram.y
src/backend/utils/adt/datetime.c
src/backend/utils/adt/timestamp.c
src/test/regress/expected/interval.out
src/test/regress/sql/interval.sql