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 1efu0s-0006ll-Qw for pgsql-docs@arkaria.postgresql.org; Sun, 28 Jan 2018 20:57:18 +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 1efu0r-00027m-JR for pgsql-docs@arkaria.postgresql.org; Sun, 28 Jan 2018 20:57:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1efu0r-00027b-5v for pgsql-docs@lists.postgresql.org; Sun, 28 Jan 2018 20:57:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1efu0o-0002SZ-K1 for pgsql-docs@postgresql.org; Sun, 28 Jan 2018 20:57:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0SKv78s015635; Sun, 28 Jan 2018 15:57:07 -0500 From: Tom Lane To: Bruce Momjian cc: Thomas Munro , ian@thepathcentral.com, pgsql-docs@postgresql.org, Andrew Gierth Subject: Re: Trigger behaviour not as stated In-reply-to: <20180128203402.GB4380@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> Comments: In-reply-to Bruce Momjian message dated "Sun, 28 Jan 2018 15:34:02 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15633.1517173027.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 28 Jan 2018 15:57:07 -0500 Message-ID: <15634.1517173027@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 cont= rast, ! 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. regards, tom lane