Fix make_timestamp[tz] to accept negative years as meaning BC.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +10 −2 |
| src/backend/utils/adt/timestamp.c | modified | +9 −5 |
| src/test/regress/expected/date.out | modified | +2 −0 |
| src/test/regress/expected/timestamp.out | modified | +10 −1 |
| src/test/regress/sql/date.sql | modified | +1 −0 |
| src/test/regress/sql/timestamp.sql | modified | +4 −1 |
Documentation touched
Discussion
- BUG #16419: wrong parsing BC year in to_date() function 35 messages · 2020-05-06 → 2020-10-01