Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xmlf0-0005gG-K1 for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Nov 2014 15:41:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xmlez-0002zH-OZ for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Nov 2014 15:41:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xmley-0002zA-Rx for pgsql-bugs@postgresql.org; Fri, 07 Nov 2014 15:41:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xmlev-0004O4-Bk for pgsql-bugs@postgresql.org; Fri, 07 Nov 2014 15:41:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id sA7Fevdv004927; Fri, 7 Nov 2014 10:40:57 -0500 From: Tom Lane To: hunsakerbn@ldschurch.org cc: Bruce Momjian , Magnus Hagander , hunsakerbn@familysearch.org, pgsql-bugs Subject: Re: BUG #11883: Year 1500 not treated as leap year when it was a leap year In-reply-to: <20141107151611.GD4482@gr8.dev> References: <20141105175607.26929.23188@wrigleys.postgresql.org> <20141105180225.GB10345@momjian.us> <15535.1415211201@sss.pgh.pa.us> <20141106073451.GA4253@momjian.us> <20141106142949.GA4487@gr8.dev> <20141107070257.GA29045@momjian.us> <20141107151611.GD4482@gr8.dev> Comments: In-reply-to Bruce Hunsaker message dated "Fri, 07 Nov 2014 08:16:11 -0700" Date: Fri, 07 Nov 2014 10:40:57 -0500 Message-ID: <4926.1415374857@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Bruce Hunsaker writes: > Just to add some additional background, We were migrating data from > an Oracle DB when we hit this. Oracle's dates are Julian based > and range from Jan 1, 4712 BCE to Dec 31 9999 CE. So Feb 29, 1500 > is a valid date in an Oracle Date type (Julian day 2268992). So I > wonder what the rules might be to convert a Julian date to a > 'proleptic Gregorian' date (pre 1582) and vice versa? I think you have a bigger data-integrity problem than you realize. Perhaps I'm jumping to conclusions based on your return address, but I suppose what you've got here is a database of historical birth and death records from lots of different countries? Your problem, as I mentioned upthread, is that you're going to need some context to figure out whether any given recorded date was meant as Julian or Gregorian. If you don't know that for sure, applying a transformation that's only going to be right for 80% or 90% of your data will make things worse not better. In the short term you'd probably be best off just storing the Oracle output as text. You could consider converting it to some type with stronger semantics later, but you'll have enough on your plate making the switch at all. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs