timestamp datatyp problem
timestamp datatyp problem
От:
"Mathias Palm" <m.palm@geoinsoft.de>
Дата:
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? Mathias Palm
Re: timestamp datatyp problem
От:
Richard Huxton <dev@archonet.com>
Дата:
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