pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tena Sakai <tsakai@gallo.ucsf.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: what's wrong with my date comparison?
Date: Tue, 16 Oct 2007 16:53:56 -0400
Message-ID: <23446.1192568036@sss.pgh.pa.us> (raw)
In-Reply-To: <FE44E0D7EAD2ED4BB2165071DB8E328C03062CEB@egcrc-ex01.egcrc.org>
References: <FE44E0D7EAD2ED4BB2165071DB8E328C03062CEA@egcrc-ex01.egcrc.org>
	<FE44E0D7EAD2ED4BB2165071DB8E328C03062CEB@egcrc-ex01.egcrc.org>

"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



view thread (5+ messages)

Message-ID: <23446.1192568036@sss.pgh.pa.us>
Permalink:  ../23446.1192568036@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23446.1192568036@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tsakai@gallo.ucsf.edu
  Subject: Re: what's wrong with my date comparison?
  In-Reply-To: <23446.1192568036@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox