Re: Trigger behaviour not as stated - Mailing list pgsql-docs

From Bruce Momjian
Subject Re: Trigger behaviour not as stated
Date
Msg-id 20180129152832.GA11613@momjian.us
Whole thread Raw
In response to Re: Trigger behaviour not as stated  ("Ian R. Campbell" <ian.campbell@thepathcentral.com>)
List pgsql-docs
On Mon, Jan 29, 2018 at 11:32:34AM +0000, Ian R. Campbell wrote:
> The second part of the confusion is that INSERT is not considered to be a row
> modification and will fire a BEFORE INSERT trigger on the parent table even
> when the data goes into a child (whereas UPDATE and DELETE will not fire a
> parent trigger).

Ian, that is not true based on my testing.  Running that attached script
that I already posted shows:

    test=> INSERT INTO parent VALUES (1, 'one');
    NOTICE:  Called by parent INSERT
    INSERT 0 1
    test=> INSERT INTO child VALUES (2, 'two');
-->    NOTICE:  Called by child INSERT
    INSERT 0 1

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

Attachment

pgsql-docs by date:

Previous
From: "Ian R. Campbell"
Date:
Subject: Re: Trigger behaviour not as stated
Next
From: PG Doc comments form
Date:
Subject: SPI not defined.