Re: wierd AND condition evaluation for plpgsql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: wierd AND condition evaluation for plpgsql
Дата
Msg-id 2787.1022594763@sss.pgh.pa.us
обсуждение исходный текст
Ответ на wierd AND condition evaluation for plpgsql  (Louis-David Mitterrand <vindex@apartia.org>)
Список pgsql-hackers
Louis-David Mitterrand <vindex@apartia.org> writes:
> I just noticed plpgsql evaluates all AND'ed conditions even if the first
> one fails. Example:

>     elsif TG_OP = ''UPDATE'' and old.type_reponse = ''abandon''

> This will break stuff if the trigger is used on INSERT as
> "old.type_reponse" will be substituted and return an error.

I think you are confusing "evaluation" with "syntax checking".

Try putting the reference to OLD inside a nested IF command.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: strange update problem with 7.2.1
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Replication status & point-in-time recovery