Re: Supported plpgsql BEFORE ... EACH ROW behavior

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Supported plpgsql BEFORE ... EACH ROW behavior
Дата
Msg-id 45DE9FCD.6030306@archonet.com
обсуждение исходный текст
Ответ на Supported plpgsql BEFORE ... EACH ROW behavior  ("Karl O. Pinc" <kop@meme.com>)
Ответы Re: Supported plpgsql BEFORE ... EACH ROW behavior  ("Karl O. Pinc" <kop@meme.com>)
Список pgsql-general
Karl O. Pinc wrote:
> Hi,
>
> I want to write a plpgsql function for use as a
> BEFORE ... EACH ROW function.  I want to modify
> other tables even when the function returns NULL
> and therefore the table on which the BEFORE
> trigger is defined is not updated.

> Sorry for being paranoid about this but I
> want to double check before relying on
> behavior that few people probably use.

I think it's fairly common, actually. Returning NULL is cancelling the
update *of that row* rather than aborting the transaction, so all
side-effects should always survive.

Otherwise you couldn't update 100 rows and just skip one or two by
returning NULL from a before trigger.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Marek Lewczuk
Дата:
Сообщение: Re: Warning "TupleDesc reference leak"
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Large Objects