Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1efvuH-0006sK-5u for pgsql-docs@arkaria.postgresql.org; Sun, 28 Jan 2018 22:58:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1efvuF-0001zo-9E for pgsql-docs@arkaria.postgresql.org; Sun, 28 Jan 2018 22:58:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1efvuF-0001zZ-3X for pgsql-docs@lists.postgresql.org; Sun, 28 Jan 2018 22:58:35 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1efvu7-0007Gy-95 for pgsql-docs@postgresql.org; Sun, 28 Jan 2018 22:58:34 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1efvu4-00020D-9q; Sun, 28 Jan 2018 17:58:24 -0500 Date: Sun, 28 Jan 2018 17:58:24 -0500 From: Bruce Momjian To: Tom Lane Cc: Thomas Munro , ian@thepathcentral.com, pgsql-docs@postgresql.org, Andrew Gierth Subject: Re: Trigger behaviour not as stated Message-ID: <20180128225824.GA5022@momjian.us> References: <20171129193934.27108.30796@wrigleys.postgresql.org> <20180124181008.GK17109@momjian.us> <20180124220701.GP17109@momjian.us> <28238.1517167118@sss.pgh.pa.us> <20180128203402.GB4380@momjian.us> <15634.1517173027@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ew6BAiZeqk4r7MaW" Content-Disposition: inline In-Reply-To: <15634.1517173027@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --ew6BAiZeqk4r7MaW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jan 28, 2018 at 03:57:07PM -0500, Tom Lane wrote: > Bruce Momjian writes: > > Uh, I don't think we want to highlight the statement vs row difference > > here but the fact that statement triggers fire on the referenced object > > and not on the effected rows. I have attached an updated patch which I > > think is an improvement > > statement-level triggers for its partitions or child tables. In contrast, > ! row-level triggers are fired on the rows in effected partitions or > ! child tables, even if they are not referenced in the query. > > I still think that that's not well written. A large part of the confusion > here is over what "referenced" means. To my mind, child tables/partitions > are referenced by an inherited query, just not explicitly. So that's why > I'd prefer wording like "directly named in the query" (or "explicitly > named"). If you insist on using "referenced" you could write "explicitly > referenced", but IMO that's longer and no clearer. > > A lesser complaint is that this reads like the antecedent of "they" is the > rows, not the tables containing them, making the meaning of "referenced" > even less clear. > > Maybe something like > > In contrast, row-level triggers are fired for individual row change > events, and the triggers that are fired for an event are those > attached to the specific table containing the changed row, even if > it is a partition or child table not directly named in the query. Oh, I am sorry. I was focused on the first part of the sentence and didn't notice your change to the second part. How is this attachment? -- Bruce Momjian 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 + --ew6BAiZeqk4r7MaW Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="trigger.diff" diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml new file mode 100644 index a8c0b57..6519757 *** a/doc/src/sgml/ref/create_trigger.sgml --- b/doc/src/sgml/ref/create_trigger.sgml *************** UPDATE OF column_name1 Modifying a partitioned table or a table with inheritance children fires ! statement-level triggers directly attached to that table, but not statement-level triggers for its partitions or child tables. In contrast, ! row-level triggers are fired for all affected partitions or child tables. If a statement-level trigger has been defined with transition relations named by a REFERENCING clause, then before and after images of rows are visible from all affected partitions or child tables. --- 501,510 ---- Modifying a partitioned table or a table with inheritance children fires ! statement-level triggers directly attached to the referenced table, but not statement-level triggers for its partitions or child tables. In contrast, ! row-level triggers are fired on the rows in effected partitions or ! child tables, even if they are not explicitly named in the query. If a statement-level trigger has been defined with transition relations named by a REFERENCING clause, then before and after images of rows are visible from all affected partitions or child tables. --ew6BAiZeqk4r7MaW--