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

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 (view raw or flat)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group