Unix Technical Forum

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

This is a discussion on Re: [BUGS] bug in timestamp and out of range values within the pgsql Hackers forums, part of the PostgreSQL category; --> >> but again to_date doesn't: >> >> regression=# select to_date('4714-01-27 BC', 'YYYY-MM-DD BC'); >> to_date >> --------------- >> 4714-01-27 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 06:31 AM
Joshua D. Drake
 
Posts: n/a
Default Re: [BUGS] bug in timestamp and out of range values


>> 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


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 06:31 AM
Joshua D. Drake
 
Posts: n/a
Default Re: [BUGS] bug in timestamp and out of range values

>
> 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


And further this with timestamp instead of date:

postgres=# create table timestamptest(test timestamp);
CREATE TABLE
postgres=# insert into timestamptest
values (to_date('4714-01-27 BC', 'YYYY-MM-DD BC'));
INSERT 159911988 1
postgres=# select * from timestamptest;
ERROR: timestamp out of range

Sincerely,

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


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:11 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com