Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 332584da9cfdbe91a651427a9fc3ed76dffaa529
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2019-12-12T17:30:44Z
Releases: 11.7
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

Files

Discussion