Minor mathematical error in documentation

Поиск
Список
Период
Сортировка
От Russell Smith
Тема Minor mathematical error in documentation
Дата
Msg-id 478FABE2.1080903@pws.com.au
обсуждение исходный текст
Ответы Re: Minor mathematical error in documentation  (Peter Eisentraut <peter_e@gmx.net>)
Re: Minor mathematical error in documentation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Hi,

I've had this minor bugbear with this part of the docs for a while and
am finally reporting it.

http://www.postgresql.org/docs/8.3/static/sql-expressions.html (And all
back branch documentation)

SELECT ... WHERE x <> 0 AND y/x > 1.5;

But this is safe:

SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END;

A CASE construct used in this fashion will defeat optimization attempts,
so it should only be done when necessary. (In this particular example,
it would be best to sidestep the problem by writing y > 1.5*x instead.)


In-equality transformations do not guarantee that y > 1.5x == y/x >
1.5.  This is only true for x>0, y < 1.5*x for x<0.  I have not posted a
patch as I'm not sure what is the best way to change the example.

Regards

Russell Smith

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

Предыдущее
От: "Steven Flatt"
Дата:
Сообщение: Re: BUG #3883: Autovacuum deadlock with truncate?
Следующее
От: "Steven Flatt"
Дата:
Сообщение: Re: BUG #3883: Autovacuum deadlock with truncate?