Re: BUG #5576: Boolean operation should not be Complete boolean evaluation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5576: Boolean operation should not be Complete boolean evaluation
Дата
Msg-id 11349.1280412868@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #5576: Boolean operation should not be Complete boolean evaluation  ("y.y.chen" <segma.yychen@msa.hinet.net>)
Список pgsql-bugs
"y.y.chen" <segma.yychen@msa.hinet.net> writes:
> When I run SQL -scripts in trigger/PlpgSQL:

> IF (TG_OP = 'INSERT') OR (old.size<>new.size) THEN
> .......
> END IF;

>  It raise a exception: RECORD old never be defined,
>  while TG_OP is 'INSERT'.

Yup, that's how it works.  SQL OR is not guaranteed to be short-circuit
in the same way it is in some programming languages.  You need to use
nested IF statements to make this work safely.

            regards, tom lane

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

Предыдущее
От: "y.y.chen"
Дата:
Сообщение: BUG #5577: Boolean operation should not be Complete boolean evaluation
Следующее
От: "Henk Enting"
Дата:
Сообщение: BUG #5582: check constraints get merged to often with multiple inheritance