X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A859D47638E for ; Wed, 7 May 2003 11:37:09 -0400 (EDT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 8B7AE47632D for ; Wed, 7 May 2003 11:36:41 -0400 (EDT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3014913; Wed, 07 May 2003 08:36:46 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Thomas Good , Tom Lane Subject: Re: Date Anomaly?? Date: Wed, 7 May 2003 08:36:34 -0700 User-Agent: KMail/1.4.3 Cc: Ian Barwick , Postgres SQL List References: In-Reply-To: MIME-Version: 1.0 Message-Id: <200305070836.34610.josh@agliodbs.com> Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-33.0 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,QUOTE_TWICE_1, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/126 X-Sequence-Number: 13291 Thomas, > > > Another item: if I say 'export PGDATESTYLE=3DUS' and ask psql for > > > the date I get back an ISO date (YYYY-MM-DD). What region of this > > > US is this, I wonder? Must be San Francisco (maybe Josh knows ;-) Yeah, it's my fault. Here in SF we're never sure what year it is, so we pu= t=20 the year first. > Bottom line: there is no way to return a MM-DD-YYYY value? Really easy, actually: SELECT to_char(datefield, 'MM-DD-YYYY'); > I never realised that the morphology of the traditional Postgres date > was this complex (its declension was not apparent until I used the > INTERVAL keyword) and so I've conditioned my users to using hyphens > as delimiters...argh. Should have used slashes I suppose. That's the price you pay for having "real" dates instead of the delimited= =20 string stored by other, less sophisticated, database systems. One of the things on my todo list (Item #18, though) is a pl/perl function= =20 that will accept any reasonable US date and return ISO standard for insert;= =20 I'll post it to the list when I'm done (maybe next week). --=20 Josh Berkus Aglio Database Solutions San Francisco