Re: [GENERAL] Needed function IF(expr, expr, expr)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] Needed function IF(expr, expr, expr)
Дата
Msg-id 18180.1062983689@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [GENERAL] Needed function IF(expr, expr, expr)  (Greg Stark <gsstark@mit.edu>)
Список pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> Hm. I wonder if there are cases of people using functions like this with
> user-defined volatile functions depending on the function's side effects
> happening the correct number of times. Or do volatile functions not get
> inlined like this?

SQL functions can't have side effects, at least not if they are simple
SELECTs, which is the only kind that gets inlined.

> To do it I think you would need a iseq() function that compared NULLs as being
> equal.

No, just
CASE WHEN (col = checkval) OR (col IS NULL AND checkval IS NULL)...
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Needed function IF(expr, expr, expr)
Следующее
От: Rod Taylor
Дата:
Сообщение: Re: [GENERAL] Needed function IF(expr, expr, expr)