Felipe Alvarez Harnecker <felipe(at)qlsoft(dot)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