Skip site navigation (1) Skip section navigation (2)

Re: bug in timestamp and out of range values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: bug in timestamp and out of range values
Date: 2006-11-02 22:48:06
Message-ID: 22100.1162507686@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> writes:
> pagila=# select to_date('3232098', 'MM/DD/YYYY');
>     to_date
> ---------------
>  4568-06-26 BC
> (1 row)

to_date's absymal lack of error checking is well known.  It should
surely refuse that input altogether, given that format string.
Feel free to send a patch ...

As for the range issue, date_in does refuse negative Julian dates:

regression=# select '4714-01-27 BC'::date;
ERROR:  date out of range: "4714-01-27 BC"

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)

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Andrew SullivanDate: 2006-11-02 23:07:31
Subject: Re: Force 8.2 initdb to rename pg_database/pg_class minxid columns?
Previous:From: Robert TreatDate: 2006-11-02 22:27:04
Subject: bug in timestamp and out of range values

pgsql-bugs by date

Next:From: Leonid ShlyapnikovDate: 2006-11-03 02:01:41
Subject: BUG #2731: Cannot install PostgreSQL server on WinXP Media Center Edition
Previous:From: Robert TreatDate: 2006-11-02 22:27:04
Subject: bug in timestamp and out of range values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group