You are absoletely correct, quoting the zero did the trick...
And my database has been intialized with Norwegian local, so I am
guessing that that's reason....
Thanks to all fo you... :)
BTJ
On Thu, 2003-09-11 at 16:26, Tom Lane wrote:
> =?ISO-8859-1?Q?Bj=F8rn?= T Johansen <btj@havleik.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