From: | <terry(at)greatgulfhomes(dot)com> |
---|---|
To: | "'Stephan Szabo'" <sszabo(at)megazone(dot)bigpanda(dot)com>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: How to quote date value? |
Date: | 2003-11-21 19:16:06 |
Message-ID: | 001701c3b063$e9fb0960$2766f30a@development.greatgulfhomes.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
If you want an explicit date, then cast it like this:
SELECT '1/11/2003'::date AS "InvoiceDate";
Terry Fielder
Manager Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
terry(at)greatgulfhomes(dot)com
Fax: (416) 441-9085
> -----Original Message-----
> From: pgsql-sql-owner(at)postgresql(dot)org
> [mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of Stephan Szabo
> Sent: Friday, November 21, 2003 2:04 PM
> To: pgsql-sql(at)postgresql(dot)org
> Subject: Re: [SQL] How to quote date value?
>
>
>
> 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).
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
From | Date | Subject | |
---|---|---|---|
Next Message | Randolf Richardson, DevNet SysOp 29 | 2003-11-21 19:26:31 | Re: Expressional Indexes |
Previous Message | Tomasz Myrta | 2003-11-21 19:12:44 | Re: cast varchar to numeric/money |