Re: order of clauses

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: order of clauses
Дата
Msg-id Pine.BSF.4.21.0102161100570.12403-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на order of clauses  (Patrick Welche <prlw1@newn.cam.ac.uk>)
Список pgsql-general
Well, it doesn't solve the ordering question, but you could
use a where something like this I guess:
where y>0 and (x/(case when y=0 then 1 else y end))>1

On Wed, 14 Feb 2001, Patrick Welche wrote:

> create table vals (
>   x float,
>   y float
> );
> insert into vals values (2,4);
> insert into vals values (2,2);
> insert into vals values (2,1);
> insert into vals values (2,0);
> select x/y from vals where y>0 and x/y>1;
>
> will give a divide by zero error as A=(y>0) and B=(x/y>1) can be evaluated in
> any order (A and B = B and A). I obviously would like (y>0) to happen first,
> but I don't see how this can be achieved.. Any ideas?


В списке pgsql-general по дате отправления:

Предыдущее
От: "Mitch Vincent"
Дата:
Сообщение: Re: Postgres slowdown on large table joins
Следующее
От: Michael Fork
Дата:
Сообщение: Re: order of clauses