Re: Unexpected parse behaviour for date to timestamp

From: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unexpected parse behaviour for date to timestamp
Date: 2003-03-08 04:33:44
Message-ID: 3E6972A8.9040600@mega-bucks.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
>
> 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 ...

I agree. Of course my syntax was wrong and I should have spotted the
error right away, but I agree that the parser should have thrown an error.

Could this be put on the the to-do list?

As an aside, and for my own edificaton, what is the "correct" was to
pass a date in as an SQL argument? Using '2003-01-01' works but it seems
the parser is actually viewing this as text and not a date? Is this the
way it should be?

Jc

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-03-08 04:48:50 Re: Unexpected parse behaviour for date to timestamp
Previous Message Christopher Kings-Lynne 2003-03-08 04:09:01 Re: [GENERAL] problems with dropped columns