Re: date style bug - Mailing list pgsql-bugs

From Tom Lane
Subject Re: date style bug
Date
Msg-id 14908.995898324@sss.pgh.pa.us
Whole thread Raw
In response to date style bug  (Felipe Alvarez Harnecker <felipe@qlsoft.cl>)
List pgsql-bugs
Felipe Alvarez Harnecker <felipe@qlsoft.cl> writes:
> obelix3=> set datestyle=postgres,euro;
> SET VARIABLE

> obelix3=> select * from orden_visita where fecha_emision <= 'today'::date;
> ERROR:  Bad date external representation '07-17-2001'

Since '07-17-2001' is *not* a valid date in Euro convention
(dd-mm-yyyy), I don't see any bug here.

I take it fecha_emision is a text or varchar field that your query is
casting to date on-the-fly.  Perhaps you'd be better advised to use
datatype date (or timestamp) for the field in the first place.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: create view bug
Next
From: Tom Lane
Date:
Subject: Re: create view bug