Re: BUG #16419: wrong parsing BC year in to_date() function
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>,
Laurenz Albe <laurenz.albe@cybertec.at>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-29T18:18:58Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- fix-to-date-for-negative-years.patch (text/x-diff) patch
I wrote: > I think this is nuts. The current behavior is obviously broken; > we should just treat it as a bug and fix it, including back-patching. > I do not think there is a compatibility problem of any significance. > Who out there is going to have an application that is relying on the > ability to insert BC dates in this way? Concretely, I propose the attached. This adjusts Dar Alathar-Yemen's patch (it didn't do the right thing IMO for the combination of bc and year < 0) and adds test cases and docs. Oracle would have us throw an error for year zero, but our historical behavior has been to read it as 1 BC. That's not so obviously wrong that I'd want to change it in the back branches. Maybe it could be done as a follow-up change in HEAD. regards, tom lane
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