X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BC33FD1D1A4 for ; Fri, 20 Feb 2004 15:35:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 10527-10 for ; Fri, 20 Feb 2004 11:35:19 -0400 (AST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id CF2BAD1B456 for ; Fri, 20 Feb 2004 11:35:14 -0400 (AST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i1KFY9Ir014814; Fri, 20 Feb 2004 08:34:10 -0700 (MST) Date: Fri, 20 Feb 2004 08:27:14 -0700 (MST) From: "scott.marlowe" To: Silke Trissl Cc: Subject: Re: date format in 7.4 In-Reply-To: <40362082.7070900@informatik.hu-berlin.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/308 X-Sequence-Number: 16998 On Fri, 20 Feb 2004, Silke Trissl wrote: > Hi, > > I have an application where users can enter the date via a web interface. > > Recently I upgrated my PostgreSQL version from 7.3 to 7.4.1. > > On 7.3 I run several tests about the format of the date and found, > that Postgres accepts almost everything. Today I found out, that 7.4.1 > only accepts dates in the format mm-dd-yy, although the documentation > still states the following > # > > 5. > > Otherwise the date field ordering is assumed to follow the > DateStyle setting: mm-dd-yy, dd-mm-yy, or yy-mm-dd. Throw an error if a > month or day field is found to be out of range. > > # > ref: http://www.postgresql.org/docs/7.4/interactive/datetime-appendix.html > > Does anyone know, if it is intentional to restrict it to mm-dd-yy format > or is is just a bug of 7.4.1? It is intentional. But, it's not as restricted as you might think. You can set the style to one of several ways you can set it. http://www.postgresql.org/docs/7.4/static/datatype-datetime.html the idea behind fixing this in 7.4 was that if you set a date style of SQL, DMY then it would be wring for the database to access a date of 3/14/04 and convert it to March 14th, since your date style said that march 14th should come in as 14/03/04. I.e. it's better at checking ranges and throwing out the ones that don't fit. Better to have a problem getting the wrong data into the database than trying to get it back out a couple years down the road.