pgsql: Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.
Date: 2019-12-12 17:31:04
Message-ID: E1ifSIq-00071B-TX@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/07c4b6ac7d6e467f9db681772b5d5101144fcfe7

Modified Files
--------------
src/backend/utils/adt/timestamp.c | 7 +++++++
src/test/regress/expected/timestamp.out | 2 +-
src/test/regress/expected/timestamptz.out | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2019-12-12 17:31:05 pgsql: Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.
Previous Message Tom Lane 2019-12-12 17:13:18 pgsql: Remove redundant function calls in timestamp[tz]_part().