| От | Peter Eisentraut |
|---|---|
| Тема | Re: Minor mathematical error in documentation |
| Дата | |
| Msg-id | 200801172056.02664.peter_e@gmx.net обсуждение |
| Ответ на | Minor mathematical error in documentation (Russell Smith <mr-russ@pws.com.au>) |
| Список | pgsql-bugs |
Russell Smith wrote: > 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 So the proper expression would be SELECT ... WHERE CASE WHEN x >= 0 THEN y > 1.5*x ELSE y < 1.5*x END; or SELECT ... WHERE (x >= 0 AND y > 1.5*x) OR y < 1.5*x; which obviously isn't simpler. So I suggest that we just delete the parenthetical note. -- Peter Eisentraut http://developer.postgresql.org/~petere/
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера