Strange behavior with leap dates and centuries BC

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Strange behavior with leap dates and centuries BC
Date: 2008-02-25 14:46:41
Message-ID: 2F0F5BDC74EB050246A4DB48@imhotep.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I saw this strange behavior due to a customer problem who managed to get
dumps which aren't restorable anymore:

CREATE TABLE foo(datum date);

INSERT INTO foo VALUES('0000-02-29');
INSERT 0 1

SELECT * FROM foo;
datum
---------------
0001-02-29 BC
(1 row)

COPY foo TO STDOUT;
0001-02-29 BC

INSERT INTO foo VALUES('0001-02-29 BC');
ERROR: date/time field value out of range: "0001-02-29 BC"

Huh? It seems the calculation for leap dates with negative year values is
broken. This example was taken from a current HEAD checkout today, the
original version i've seen this behavior first was 8.2.4.

--
Thanks

Bernd

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2008-02-25 15:00:37 Re: Questions about indexes with text_pattern_ops
Previous Message Peter Eisentraut 2008-02-25 14:45:42 Re: Avahi support for Postgresql