Re: Unexpected parse behaviour for date to timestamp - Mailing list pgsql-general

From Tom Lane
Subject Re: Unexpected parse behaviour for date to timestamp
Date
Msg-id 1084.1047057833@sss.pgh.pa.us
Whole thread Raw
In response to Re: Unexpected parse behaviour for date to timestamp  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> On Sat, 8 Mar 2003, Jean-Christian Imbeault wrote:
>> # select submit from invoices where submit <= 2003-03-09;

> The right side isn't a date.  It's an integral expression that evaluates
> to 1991 I believe.

Yeah.  And IMHO this should be rejected entirely; there is no "date <= int4"
operator.  If you dig into it you find that the parser is actually
interpreting the query as WHERE submit::text <= '1991'::text.
Apparently "text <= text" is the closest match it can find.

This is just another example of why allowing implicit coercions from
everything to text is a Bad Idea ...

            regards, tom lane

pgsql-general by date:

Previous
From: "Ed L."
Date:
Subject: Re: replicating DDL statements
Next
From: Bruce Momjian
Date:
Subject: Re: nextval::text