Re: BUG #16216: the result of to_date function with negative year number not same as BC year number

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: szx9231(at)gmail(dot)com, PostgreSQL Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16216: the result of to_date function with negative year number not same as BC year number
Date: 2020-01-17 15:29:52
Message-ID: 27853.1579274992@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
>> I'm pretty sure that's intentional; if you specify two or fewer
>> year digits, a year between 1970 and 2069 is presumed to be meant.

> Hmmm. Ok, I see.

> If I write a fuzzy "31/12/01", I'm pretty okay with 2001-12-31. but if I
> write '1 AD', I would expect '1 AD'.

Yeah, a case could be made for applying that rule only when there's
exactly two year digits. OTOH, it's been like this for a very long
time with few complaints. Besides, it'd still be weird when you
write "11 AD", so really people who are dealing with such dates
need to learn to write four year digits.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-01-17 18:29:54 Re: BUG #16213: segfault when running a query
Previous Message Fabien COELHO 2020-01-17 15:15:15 Re: BUG #16216: the result of to_date function with negative year number not same as BC year number