Re: what's wrong with my date comparison? - Mailing list pgsql-sql

From Tom Lane
Subject Re: what's wrong with my date comparison?
Date
Msg-id 23446.1192568036@sss.pgh.pa.us
Whole thread Raw
In response to Re: what's wrong with my date comparison?  ("Tena Sakai" <tsakai@gallo.ucsf.edu>)
List pgsql-sql
"Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
> I was missing quotes.
> It must have evaluated 2007-10-02 and used it as a
> numerical constant 1995.

Actually, what you got was a *textual* comparison between '1995' and
the timestamp converted to text, which makes even less sense.

FWIW, as of PG 8.3 you'll get an error:

regression=# select * from timestamp_tbl where d1 > 2007-10-02;
ERROR:  operator does not exist: timestamp without time zone > integer
LINE 1: select * from timestamp_tbl where d1 > 2007-10-02;                                            ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

We've seen too many people get burnt by variants of this problem...
        regards, tom lane


pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: what's wrong with my date comparison?
Next
From: "Sofer, Yuval"
Date:
Subject: when inserting to table, text type parameter become NULL (after big assignment to this parameter)