Re: Unexpected parse behaviour for date to timestamp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unexpected parse behaviour for date to timestamp
Date: 2003-03-07 17:23:53
Message-ID: 1084.1047057833@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-03-07 17:24:31 Re: nextval::text
Previous Message Ed L. 2003-03-07 17:19:47 Re: replicating DDL statements