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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: timestamp datatyp problem


  • From: Richard Huxton <dev(at)archonet(dot)com>
  • To: Mathias Palm <m(dot)palm(at)geoinsoft(dot)de>
  • Cc: pgsql-hackers(at)postgresql(dot)org
  • Subject: Re: timestamp datatyp problem
  • Date: Thu, 31 May 2007 16:36:53 +0100
  • Message-id: <465EEB95.8050602@archonet.com> <text/plain>

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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group