"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