X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C63CC53524 for ; Wed, 30 Mar 2005 22:23:50 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51672-04 for ; Wed, 30 Mar 2005 21:23:42 +0000 (GMT) Received: from bramble.mmrd.com (bramble.mmrd.com [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id C26BB53561 for ; Wed, 30 Mar 2005 22:23:40 +0100 (BST) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by bramble.mmrd.com (8.12.8/8.12.8) with ESMTP id j2UL0voJ006892; Wed, 30 Mar 2005 16:00:57 -0500 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [10.225.10.110]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id j2ULNZM20511; Wed, 30 Mar 2005 16:23:35 -0500 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id 12GRMA4P; Wed, 30 Mar 2005 16:23:32 -0500 Subject: Re: Postgres 7.3 migrate to 8.0 date problems. From: Robert Treat To: Scott Marlowe Cc: Thomas Seeber , pgsql-sql@postgresql.org In-Reply-To: <1112042886.22988.12.camel@state.g2switchworks.com> References: <578aa3f70503281144200c2404@mail.gmail.com> <1112042886.22988.12.camel@state.g2switchworks.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 30 Mar 2005 16:23:34 -0500 Message-Id: <1112217814.28784.419.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/399 X-Sequence-Number: 20878 On Mon, 2005-03-28 at 15:48, Scott Marlowe wrote: > On Mon, 2005-03-28 at 13:44, Thomas Seeber wrote: > > Hi, > > > > We were upgrading from postgres 7.3 -> 8.0 and having a little > > problems importing dates from some of our data sources. Say we have a > > date like '2004-17-05'. In postgres 7.3, postgres would intrept this > > as Year Day Month automatically. In the documentation, from postgres > > 7.4 on this has to be specified in the Datestyle option and YDM is not > > an option. Other data we have is coming in on the YMD formate which > > would be more expected. I realize that this change is better for data > > integrity, however we have alot of legacy systems where being able to > > mimic the 7.3 behaviour would be desireable. Any ideas? > > Fix the data? I had to write a lot of scripts to keep dates like that > OUT of my last PostgreSQL installation, which was running 7.2 Which is > why, as the guy who whinged and moaned until this behavioural change was > made, I feel for you, but honestly, the lackadaisical manner of handing > that particular format (YYYY-DD-MM) never really seemed right even to > the people who fought me on the idea of changing the default behaviour > of DD/MM/YYYY versus MM/DD/YYYY. > > While the US uses MM/DD/YYYY and Europe uses DD/MM/YYYY, and there may > be some arguments for handling a sloppy version of one of those, > computer folk (and the government) who want easily ordered dates use > YYYY-MM-DD, I've never seen a good argument made for the usage of > YYYY-DD-MM before. > > Are you sure that the other dates in your data set are what you think > they are? Because if the two numbers are both <=12, then you'll get one > "date" and if the wrong one is >12 you'll get another. That can't be > good. > Would it be possible to use a BEFORE trigger to reformat the YYYY-DD-MM date to YYYY-MM-DD ? The error I see on 7.4 is ERROR: date/time field value out of range: "2005-14-01" so ISTM you could do some data manipulation if you wanted. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL