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: Robert Haas <robertmhaas@gmail.com>
Cc: Bruce Momjian <bruce@momjian.us>,
"David G. Johnston" <david.g.johnston@gmail.com>,
Laurenz Albe <laurenz.albe@cybertec.at>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-10-01T00:40:58Z
Lists: pgsql-bugs, pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > Right. Ultimately, this comes down to a judgement call about what you > think people are likely to rely on, and what you think they are > unlikely to rely on. Good, so at least we agree on that principle. > But the present case does not seem to me to be comparable. If someone > is using to_date() to construct date values, I can't see why they > wouldn't test it, find out how it works with BC values, and then make > the application that generates the input to that function do the right > thing for the actual behavior of the function. There are discussions > of the behavior of to_date with YYYY = 0 going back at least 10 years > on this mailing list, and more recent discussions of the behavior of > negative numbers. Sure, we have at least two bug reports proving that people have investigated this. What I'm saying is unlikely is that there are any production applications in which it matters. I doubt that, say, the Italian government has a citizenry database in which they've recorded Julius Caesar's birthday; and even if they do, they're probably not squirting the data through to_date; and even if they are, they're more likely using the positive-year-with-BC representation, because that's the only one that PG will emit. Even if they've got code that somehow relies on to_date working this way, it's almost certainly getting zero use in practice. I probably wouldn't have taken an interest in this at all, were it not for the proposal that we document the misbehavior. Doing that rather than fixing it just seems silly. 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