| From: | "nobody" <nobody(at)nowhere(dot)near(dot)here> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: How to quote date value? |
| Date: | 2003-11-23 16:18:40 |
| Message-ID: | bpqml6$v3h$1@news.hub.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Thanks, I learnt to use:
SELECT CAST('1/11/2003' AS DATE) AS invoice_number;
and it does what I would expect ;-).
"Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com> wrote in message
news:20031121110022(dot)U75942(at)megazone(dot)bigpanda(dot)com(dot)(dot)(dot)
>
> 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-23 16:51:14 | Re: SQL a simple menu - plz help |
| Previous Message | Cristian Custodio | 2003-11-22 19:33:49 | Character invalid saving memo with UpdateSQL |