BUG #2482: Wrong result in timestamp_in, timestamptz_in, date_in

Started by Alexander Galleralmost 20 years ago2 messagesbugs
Jump to latest
#1Alexander Galler
galler@kuzbass.net

The following bug has been logged online:

Bug reference: 2482
Logged by: Alexander Galler
Email address: galler@kuzbass.net
PostgreSQL version: 8.1.3
Operating system: Windows XP
Description: Wrong result in timestamp_in, timestamptz_in, date_in
Details:

SET SESSION DateStyle TO ISO, YMD;
select '20.01.01 BC'::timestamp;
Result:
"2020-01-01 00:00:00 BC"
I want "20-01-01 00:00:00 BC"

select '20.01.01 BC'::timestamptz
Result:
"2020-01-01 00:00:00+06:11 BC"
I want "20-01-01 00:00:00+06:11 BC"

select '20.01.01 BC'::date
Result:
"2020-01-01 BC"
I want "20-01-01 BC"

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alexander Galler (#1)
Re: BUG #2482: Wrong result in timestamp_in, timestamptz_in, date_in

"Alexander Galler" <galler@kuzbass.net> writes:

select '20.01.01 BC'::timestamp;
Result:
"2020-01-01 00:00:00 BC"
I want "20-01-01 00:00:00 BC"

You can write
select '0020.01.01 BC'::timestamp;

I agree it seems like a bug that the 'yy'->'20yy' conversion is applied
to BC dates. The code appears to try to avoid that, but I think it's
confused in this case because 'BC' hasn't been scanned yet.

regards, tom lane