public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: Ian R. Campbell <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Thomas Munro <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Andrew Gierth <[email protected]>
Subject: Re: Trigger behaviour not as stated
Date: Mon, 29 Jan 2018 10:28:32 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOC8YUdZ-J42bUz2SFXsQjnAiv5YfkDR5rupN0pGP=ZLY-wt8Q@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAEepm=1cAO8y4dFv_xd=43iP7f4T3A2hYAzjgjQagHtt7H87Fw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAOC8YUdZ-J42bUz2SFXsQjnAiv5YfkDR5rupN0pGP=ZLY-wt8Q@mail.gmail.com>

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  <[email protected]>        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 +


Attachments:

  [application/x-sql] trigger.sql (970B, 2-trigger.sql)
  download

view thread (13+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Trigger behaviour not as stated
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox