Re: detect initiator of update/delete action

Поиск
Список
Период
Сортировка
От Luca Ferrari
Тема Re: detect initiator of update/delete action
Дата
Msg-id CAKoxK+6UZF6eEm8kcBApXs76-5V3Q1XqO-Dc=XRWOfP1fB2NqQ@mail.gmail.com
обсуждение исходный текст
Ответ на detect initiator of update/delete action  (ssylla <stefansylla@gmx.de>)
Список pgsql-sql
On Fri, Sep 20, 2013 at 9:52 AM, ssylla <stefansylla@gmx.de> wrote:
> There are two cases:
> 1. if the deletion was executed through a user action, both the update and
> insert statement of the 'table1_del' function should be executed
> 2. if the deletion was initiated through a function fired from another
> table, only the insert statement should be executed


There is nothing that allows a trigger to distinguish such kind of invocation.
However there is a different kind of approach that comes into my mind
and that I would try: within the trigger test for a specific temporary
table and a value into it. In the case the trigger is invoked
"directly" (1) the table will not be created, while in the case of a
trigger chain the other trigger is responsible for populating the temp
table (and the current trigger to truncate it). Of course a drawback
of this approach is that you need to create and populate the temp
table on each trigger of an higher level in the call chain.

Luca



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

Предыдущее
От: ssylla
Дата:
Сообщение: detect initiator of update/delete action
Следующее
От: Gary Stainburn
Дата:
Сообщение: unique key problem on update