Re: BUG #16419: wrong parsing BC year in to_date() function
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Bruce Momjian <bruce@momjian.us>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-04T19:45:36Z
Lists: pgsql-bugs, pgsql-hackers
On Thu, Sep 3, 2020 at 6:21 PM Bruce Momjian <bruce@momjian.us> wrote: > On Wed, Jul 15, 2020 at 09:26:53AM -0700, David G. Johnston wrote: > > > Whether to actually change the behavior of to_date is up for debate > though I > > would presume it would not be back-patched. > > OK, so, looking at this thread, we have to_date() treating -1 as -2 BC, > make_date() treating -1 as 1 BC, and we have Oracle, which to_date() is > supposed to match, making -1 as 1 BC. > > Because we already have the to_date/make_date inconsistency, and the -1 > to -2 BC mapping is confusing, and doesn't match Oracle, I think the > clean solution is to change PG 14 to treat -1 as 1 BC, and document the > incompatibility in the release notes. > I agree that someone else should write another patch to fix the behavior for v14. Still suggest committing the proposed patch to master and all supported versions to document the existing behavior correctly. The fix patch can work from that. David J.
Commits
-
Fix handling of BC years in to_date/to_timestamp.
- db96be24ce32 10.15 landed
- c5232dca8d1b 12.5 landed
- b0fe0b022f80 11.10 landed
- 99fd38c02299 13.1 landed
- 489c9c3407cb 14.0 landed
- 4857e6fe16c2 9.5.24 landed
- 19e7982681df 9.6.20 landed
-
Fix make_timestamp[tz] to accept negative years as meaning BC.
- a094c8ff5352 14.0 landed
-
doc: PG 13 relnotes, update TOAST item to mention decompression
- fb544735f114 13.0 cited