Re: Short circuit operations in plpgsql?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Short circuit operations in plpgsql?
Дата
Msg-id 27516.1103572520@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Short circuit operations in plpgsql?  (Steve Atkins <steve@blighty.com>)
Список pgsql-general
Steve Atkins <steve@blighty.com> writes:
>   IF TG_OP='INSERT' OR NEW.foo != OLD.foo THEN
>     -- do stuff

> Is there anything that guarantees that the NEW.foo != OLD.foo won't
> be evaluated (and hence fail, as there is no OLD) on an insert?

The only way is to split the expression into two IF commands.  The real
problem is not with the evaluation per se, but with plpgsql having to
pass down all the variable values used in the expression before
evaluation can start.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Diskspace
Следующее
От: "Rosny"
Дата:
Сообщение: Installing postgres 8 using Remote Desktop Connection