On Fri, Sep 20, 2013 at 9:52 AM, ssylla <[email protected]> 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 -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
