Re: [HACKERS] bug in timestamp and out of range values

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] bug in timestamp and out of range values
Date: 2006-11-03 04:27:46
Message-ID: 454AC542.8030402@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


>> but again to_date doesn't:
>>
>> regression=# select to_date('4714-01-27 BC', 'YYYY-MM-DD BC');
>> to_date
>> ---------------
>> 4714-01-27 BC
>> (1 row)
>>
>
> I'm not concerned about to_date so much as I am that timestamp_in lets you
> store values you can't read with timestamp_out. Once the value is in there
> you can happily move it around with create table as and such...

Hmmm... if that is the case, I would also have a pretty significant
concern. We have basically created an environment that is unreliable
during a restore. Not to mention violating data type constraints.

postgres=# create table timetest (test date);
CREATE TABLE
postgres=# insert into timetest
values (to_date('4714-01-27 BC', 'YYYY-MM-DD BC'));
INSERT 159911984 1

postgres=# select '4714-01-27 BC'::date;
ERROR: date out of range: "4714-01-27 BC"
postgres=# select cast(test as date) from timetest;
test
---------------
4714-01-27 BC
(1 row)

postgres=#
postgres=# select cast('4714-01-27 BC' as date);
ERROR: date out of range: "4714-01-27 BC"
postgres=#

This seems pretty broken.

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Joshua D. Drake 2006-11-03 04:34:14 Re: [HACKERS] bug in timestamp and out of range values
Previous Message Robert Treat 2006-11-03 03:52:56 Re: bug in timestamp and out of range values

Browse pgsql-hackers by date

  From Date Subject
Next Message Joachim Wieland 2006-11-03 04:30:16 "recovering prepared transaction" after server restart message
Previous Message mark 2006-11-03 04:18:29 Re: Design Considerations for New Authentication Methods