Re: timestamp datatyp problem - Mailing list pgsql-hackers

From Richard Huxton
Subject Re: timestamp datatyp problem
Date
Msg-id 465EEB95.8050602@archonet.com
Whole thread Raw
In response to timestamp datatyp problem  ("Mathias Palm" <m.palm@geoinsoft.de>)
List pgsql-hackers
Mathias Palm wrote:
> Hi,
> 
> I have found a problem by using timestamp datatyp in postgresql. The
> minimum value should be '4713-11-24 00:00:00 BC' but it's possible to
> use '4714-11-24 00:00:00 BC'. I have found the problem by using a binary
> cursor where I get the value as double. Is this the right list for
> posting this problem?

I don't know if it's a problem or not, but I'd guess the relevant bit is  in src/include/utils/datetime.h

#define JULIAN_MINYEAR (-4713)
#define JULIAN_MINMONTH (11)
#define JULIAN_MINDAY (24)
#define JULIAN_MAXYEAR (5874898)

#define IS_VALID_JULIAN(y,m,d) ((((y) > JULIAN_MINYEAR) \  || (((y) == JULIAN_MINYEAR) && (((m) > JULIAN_MINMONTH) \
||(((m) == JULIAN_MINMONTH) && ((d) >= JULIAN_MINDAY))))) \ && ((y) < JULIAN_MAXYEAR))
 

I'm guessing -4713 == 4714BC (no year 0 between 1BC and 1AD).

Presumably this can only happen if using floating-point datetimes and 
not 64-bit integers?

--   Richard Huxton  Archonet Ltd


pgsql-hackers by date:

Previous
From: "Mathias Palm"
Date:
Subject: timestamp datatyp problem
Next
From: Zoltan Boszormenyi
Date:
Subject: Re: New cast between inet/cidr and bytea