Re: wierd AND condition evaluation for plpgsql

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: wierd AND condition evaluation for plpgsql
Дата
в 10:13:11
Msg-id
2787.1022594763@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
wierd AND condition evaluation for plpgsql Louis-David Mitterrand <vindex@apartia.org>
Re: wierd AND condition evaluation for plpgsql Tom Lane <tgl@sss.pgh.pa.us>
Re: wierd AND condition evaluation for plpgsql "Joel Burton" <joel@joelburton.com>
Re: wierd AND condition evaluation for plpgsql Alessio Bragadini <alessio@albourne.com>
Re: wierd AND condition evaluation for plpgsql "Joel Burton" <joel@joelburton.com>
Re: wierd AND condition evaluation for plpgsql Tom Lane <tgl@sss.pgh.pa.us>
Re: wierd AND condition evaluation for plpgsql "Joel Burton" <joel@joelburton.com>
Re: wierd AND condition evaluation for plpgsql Tom Lane <tgl@sss.pgh.pa.us>
Re: wierd AND condition evaluation for plpgsql Peter Eisentraut <peter_e@gmx.net>
Re: wierd AND condition evaluation for plpgsql Peter Eisentraut <peter_e@gmx.net>
Re: wierd AND condition evaluation for plpgsql Hannu Krosing <hannu@tm.ee>
Re: wierd AND condition evaluation for plpgsql "Joel Burton" <joel@joelburton.com>
Re: wierd AND condition evaluation for plpgsql Hannu Krosing <hannu@tm.ee>
Re: wierd AND condition evaluation for plpgsql Tom Lane <tgl@sss.pgh.pa.us>
Louis-David Mitterrand  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
Дата:
От: Andrew Sullivan
Дата:
FAQ