From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bjørn T Johansen <btj(at)havleik(dot)no> |
Cc: | Mattias Kregert <mattias(at)kregert(dot)se>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: I need a SQL... |
Date: | 2003-09-11 14:26:01 |
Message-ID: | 26747.1063290361@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
=?ISO-8859-1?Q?Bj=F8rn?= T Johansen <btj(at)havleik(dot)no> writes:
> Yes, I am sure, I just use copy-and-paste and I have double checked....
> I am running on 7.3.4 but that shouldn't make any difference?
It'll probably work better if you quote the zero. Unquoted, you get
some weird textual comparison. Compare:
regression=# explain select * from time_tbl where f1-f1 >= 0;
QUERY PLAN
--------------------------------------------------------
Seq Scan on time_tbl (cost=0.00..1.14 rows=3 width=8)
Filter: (((f1 - f1))::text >= '0'::text)
(2 rows)
regression=# explain select * from time_tbl where f1-f1 >= '0';
QUERY PLAN
--------------------------------------------------------
Seq Scan on time_tbl (cost=0.00..1.12 rows=3 width=8)
Filter: ((f1 - f1) >= '00:00'::interval)
(2 rows)
In "C" locale, the textual comparison accidentally manages to give
the desired answers, but in other locales it would not.
(Just another example of why implicit coercions to text are evil.)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | DanPerlman | 2003-09-11 14:28:34 | Create index in PG table with vb6 |
Previous Message | Mattias Kregert | 2003-09-11 14:06:04 | Re: I need a SQL... |