]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 12 Dec 2019 17:30:44 +0000 (12:30 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 12 Dec 2019 17:30:44 +0000 (12:30 -0500)
commit6e2ac8d66d58ccdda4dcccc52f8b6b7911db0ad2
treed282f56ed4f6ff113693adf3fd5c31034689dc90
parent6bed9b4f6ea5703a68246a3e335181c658d5dd5e
Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.

The test cases added by commit 26ae3aa80 exposed an old oversight in
timestamp[tz]_part: they didn't correct the result of date2isoyear()
for BC years, so that we produced an off-by-one answer for such years.
Fix that, and back-patch to all supported branches.

Discussion: https://postgr.es/m/SG2PR06MB37762CAE45DB0F6CA7001EA9B6550@SG2PR06MB3776.apcprd06.prod.outlook.com
src/backend/utils/adt/timestamp.c
src/test/regress/expected/timestamp.out
src/test/regress/expected/timestamptz.out