Re: BUG #16419: wrong parsing BC year in to_date() function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16419: wrong parsing BC year in to_date() function
Date: 2020-09-30 22:36:37
Message-ID: 941402.1601505397@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Sep 30, 2020 at 5:35 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2020-09-30 22:36:56 Re: BUG #16419: wrong parsing BC year in to_date() function
Previous Message Robert Haas 2020-09-30 22:10:38 Re: BUG #16419: wrong parsing BC year in to_date() function

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2020-09-30 22:36:56 Re: BUG #16419: wrong parsing BC year in to_date() function
Previous Message Justin Pryzby 2020-09-30 22:34:50 CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers