Re: Trigger Function return values

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Trigger Function return values
Дата
Msg-id 201103221738.19017.adrian.klaver@gmail.com
обсуждение исходный текст
Ответ на Trigger Function return values  ("Andy Chambers" <achambers@mcna.net>)
Список pgsql-general

On Tuesday, March 22, 2011 3:12:56 pm Andy Chambers wrote:

> Hi,

>

> How is the return value of a trigger function defined in plpgsql used? I

> can't find

> anything in the documentation but some of the examples return NULL, and

> others return

> something like NEW.

>

> It seems that if the return statement is omitted, an error occurs when the

> trigger is

> fired.

From here:

http://www.postgresql.org/docs/9.0/interactive/plpgsql-trigger.html

Row triggers:

"Row-level triggers fired BEFORE can return null to signal the trigger manager to skip the rest of the operation for this row (i.e., subsequent triggers are not fired, and the INSERT/UPDATE/DELETE does not occur for this row). If a nonnull value is returned then the operation proceeds with that row value. Returning a row value different from the original value of NEW alters the row that will be inserted or updated. "

Statement triggers:

"The return value of a row-level trigger fired AFTER or a statement-level trigger fired BEFORE or AFTER is always ignored; it might as well be null. However, any of these types of triggers might still abort the entire operation by raising an error. "

--

Adrian Klaver

adrian.klaver@gmail.com

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

Предыдущее
От: Scott Ribe
Дата:
Сообщение: Re: Trigger Function return values
Следующее
От:
Дата:
Сообщение: constraint partition issue