Re: BUG #16419: wrong parsing BC year in to_date() function - Mailing list pgsql-hackers

From Tom Lane
Subject Re: BUG #16419: wrong parsing BC year in to_date() function
Date
Msg-id 941402.1601505397@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #16419: wrong parsing BC year in to_date() function  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Sep 30, 2020 at 5:35 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> By that logic, we should never fix any bug in a back branch.

> No, by that logic, we should not change any behavior in a back-branch
> upon which a customer is plausibly relying.

I guess where we differ here is on the idea that somebody is plausibly
relying on to_date() to parse a BC date inaccurately.

> One reason they might do that is because there was a discussion about
> what I believe to this exact same case 4 years ago in which you and I
> both endorsed the position you are now claiming is so unreasonable
> that nobody will mind if we change it in a minor release.
> https://www.postgresql.org/message-id/flat/CAKOSWNmwCH0wx6MApc1A8ww%2B%2BEQmG07AZ3t6w_XjRrV1xeZpTA%40mail.gmail.com

What I complained about in that thread was mainly that that
patch was simultaneously trying to get stricter (throw error for
year zero) and laxer (parse negative years as BC).

Also, we did not in that thread have the information that Oracle
treats negative years as BC.  Now that we do, the situation is
different, and I'm willing to change my mind about it.  Admittedly,
Oracle seems to require an "S" in the format to parse a leading
dash as meaning a negative year.  But given that our code is willing
to read the case as a negative year without that, it seems pretty
silly to decide that it should read it as an off-by-one negative
year.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #16419: wrong parsing BC year in to_date() function