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: 2007-05-31 15:36:53
Message-ID: 465EEB95.8050602@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zoltan Boszormenyi 2007-05-31 16:03:12 Re: New cast between inet/cidr and bytea
Previous Message Jon Colverson 2007-05-31 15:09:53 Re: Attempt to re-archive existing WAL logs after restoring from backup