Re: I need a SQL...

From: Bjørn T Johansen <btj(at)havleik(dot)no>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:30:55
Message-ID: 1063290655.13392.57.camel@dt-btj.dagbladet.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pginfo 2003-09-11 14:33:42 pg 7.3.4 and linux box crash
Previous Message Marc G. Fournier 2003-09-11 14:30:48 Re: State of Beta 2