Thread: BUG #5672: Can't input julian days BC

BUG #5672: Can't input julian days BC

From
"Benjamin Gigot"
Date:
The following bug has been logged online:

Bug reference:      5672
Logged by:          Benjamin Gigot
Email address:      therealvaldor@hotmail.com
PostgreSQL version: 8.4.4
Operating system:   Ubuntu
Description:        Can't input julian days BC
Details:

After trying to enter Confucius birthday (28th September 551BC) I had the
following error :

Query failed: ERROR: date/time field value out of range: "J1520447"

I then used a psql to try to enter different dates in the Julian days
format.

The date down to 0001-01-01 is working :

test=> INSERT INTO datetest (date) VALUES ('J1721426');
INSERT 0 1

But then under that it's not working anymore :

test=> INSERT INTO datetest (date) VALUES ('J1721425');
ERROR:  date/time field value out of range: "J1721425"
LINE 1: INSERT INTO datetest (date) VALUES ('J1721425');

Documentation specify that dates can go down to J0, that is 4713BC.

Am I missing something ?

Re: BUG #5672: Can't input julian days BC

From
Tom Lane
Date:
"Benjamin Gigot" <therealvaldor@hotmail.com> writes:
> After trying to enter Confucius birthday (28th September 551BC) I had the
> following error :

> Query failed: ERROR: date/time field value out of range: "J1520447"

Hmm ... this did work in versions before 8.4, but got broken as a
side-effect of tightening up error checking for other cases.  It
looks like we need to tweak ValidateDate() so that it won't throw
an error for BC dates when Julian notation was used.  Thanks for
the report!

            regards, tom lane