Re: [HACKERS] Re: [GENERAL] leap day bug after 1901 - Mailing list pgsql-general

From Thomas Lockhart
Subject Re: [HACKERS] Re: [GENERAL] leap day bug after 1901
Date
Msg-id 37136E7F.F2929BFC@alumni.caltech.edu
Whole thread Raw
In response to leap day bug after 1901  (José Soares <jose@sferacarta.com>)
List pgsql-general
> > > prova=> select date '1901-02-29';
> > > ERROR:  date_in: day must be limited to values 1 through 28
> > > prova=> select date '1902-02-29';
> > > ----------
> > > 1902-03-01
> > Any body knows why PostgreSQL checks for date validity only
> > for dates less than 1902 and greater than 2037 ?

postgres=> select date '1902-02-29 UTC';
ERROR:  date_in: day must be limited to values 1 through 28

For dates somewhere close the the Unix system time range, I use system
routines to determine the local time zone if it was not specified in
the input. That call also shifts/resolves the input time fields to be
consistant. Afterwards, I check for a valid day, but the shift has
already hidden the problem.

I'll look at moving the checks to within the parsing code, to just
before the time zone is resolved.

This will also affect the behavior of datetime and abstime.

                    - Tom

--
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California

pgsql-general by date:

Previous
From: De Leersnijder Frederic
Date:
Subject: Converting MS Access to postgres under linux.
Next
From: Oleg Broytmann
Date:
Subject: Re: [GENERAL] Opening two databases at the same time?