| От | Tom Lane |
|---|---|
| Тема | Re: wierd AND condition evaluation for plpgsql |
| Дата | |
| Msg-id | 1415.1022775249@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: wierd AND condition evaluation for plpgsql ("Joel Burton" <joel@joelburton.com>) |
| Список | pgsql-hackers |
"Joel Burton" <joel@joelburton.com> writes:
> Is there any generalizable help would could offer to people who write
> functions that have side effects? Don't use them in WHERE (or ON or HAVING)
> clauses? Evaluate the function in a earlier db call, then plug the resolved
> results into the SQL WHERE statement?
Certainly putting side-effects into WHERE clauses is a recipe for
trouble, and it'd not be a bad idea to point that out in the docs.
(I don't think it is mentioned at the moment.)
When you really need to control order of evaluation, you can do it
using CASE or by pushing the whole expression into a function. But
these defeat optimization so should be avoided if possible.
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера