Fix make_timestamp[tz] to accept negative years as meaning BC.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Sep 2020 17:48:06 +0000 (13:48 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Sep 2020 17:48:06 +0000 (13:48 -0400)
commita094c8ff53523e88ff9dd28ad467618039e27b58
tree74e9cb9f1ae1702f2d865481aa684b952f0375a4
parenta6b1f5365d58356b5d42829e9cd89a6c725d7a0a
Fix make_timestamp[tz] to accept negative years as meaning BC.

Previously we threw an error.  But make_date already allowed the case,
so it is inconsistent as well as unhelpful for make_timestamp not to.

Both functions continue to reject year zero.

Code and test fixes by Peter Eisentraut, doc changes by me

Discussion: https://postgr.es/m/13c0992c-f15a-a0ca-d839-91d3efd965d9@2ndquadrant.com
doc/src/sgml/func.sgml
src/backend/utils/adt/timestamp.c
src/test/regress/expected/date.out
src/test/regress/expected/timestamp.out
src/test/regress/sql/date.sql
src/test/regress/sql/timestamp.sql