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

From Jean-Christian Imbeault
Subject Re: Unexpected parse behaviour for date to timestamp
Date
Msg-id 3E6972A8.9040600@mega-bucks.co.jp
Whole thread Raw
In response to Re: Unexpected parse behaviour for date to timestamp  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: Unexpected parse behaviour for date to timestamp
List 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


pgsql-general by date:

Previous
From: Richard Welty
Date:
Subject: Re: Replacing rpm installation with tarball
Next
From: Tom Lane
Date:
Subject: Re: Unexpected parse behaviour for date to timestamp