X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 48335D1B575 for ; Fri, 21 Nov 2003 19:05:04 +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 65111-09 for ; Fri, 21 Nov 2003 15:04:34 -0400 (AST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 46C31D1CA61 for ; Fri, 21 Nov 2003 15:04:33 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 7B61935418; Fri, 21 Nov 2003 11:04:18 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 7A4A135268 for ; Fri, 21 Nov 2003 11:04:18 -0800 (PST) Date: Fri, 21 Nov 2003 11:04:18 -0800 (PST) From: Stephan Szabo To: "pgsql-sql@postgresql.org" Subject: Re: How to quote date value? In-Reply-To: <3FBE52FC.3060503@bigfoot.com> Message-ID: <20031121110022.U75942@megazone.bigpanda.com> References: <3FBE52FC.3060503@bigfoot.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/265 X-Sequence-Number: 16080 On Fri, 21 Nov 2003, Gaetano Mendola wrote: > nobody wrote: > > I have found it in documentation, it is single quote. But it does not > > explain why > > > > SELECT '1/11/2003' AS "InvoiceDate"; > > > > returns "unknown" data type instead of "date". (I haven't seen the original message yet, so I'm replying to a reply) Date literals are generally written as: DATE '1/11/2003' PostgreSQL will try to guess what type you meant with quoted strings in expressions, but in the above there isn't enough context to do guess that you meant a date really (it should probably actually be thought of as a string in such cases).