Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlEeA-0003nD-8W for pgsql-docs@arkaria.postgresql.org; Tue, 16 Jun 2020 16:41:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlEe9-0001If-6K for pgsql-docs@arkaria.postgresql.org; Tue, 16 Jun 2020 16:41:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlEe9-0001IX-0Z for pgsql-docs@lists.postgresql.org; Tue, 16 Jun 2020 16:41:13 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlEe6-0008Tm-MH for pgsql-docs@lists.postgresql.org; Tue, 16 Jun 2020 16:41:11 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jlEe4-0004mi-SR; Tue, 16 Jun 2020 12:41:08 -0400 Date: Tue, 16 Jun 2020 12:41:08 -0400 From: Bruce Momjian To: Tom Lane Cc: petermpallesen@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Not using suppress_redundant_updates_trigger in sql-createtrigger.html#examples Message-ID: <20200616164108.GA12171@momjian.us> References: <159195294959.673.5752624528747900508@wrigleys.postgresql.org> <20200616103644.GE31175@momjian.us> <1300920.1592316494@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline In-Reply-To: <1300920.1592316494@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 16, 2020 at 10:08:14AM -0400, Tom Lane wrote: > Bruce Momjian writes: > > I have created the attached patch to mention > > suppress_redundant_updates_trigger() in this case. I don't think having > > an actual example is warranted. > > I don't like this patch, because in fact > suppress_redundant_updates_trigger is entirely unrelated to the stated > purpose of that example (namely, to log something if the table was > changed). The way you've written it makes it sound like > suppress_redundant_updates_trigger could be used as an alternative > implementation of that requirement. Ah, I see your point. > If you want to mention suppress_redundant_updates_trigger somewhere > in this area, that's fine, but it should be treated as an independent > topic rather than being wedged into the middle of an unrelated example. > Maybe a distinct para saying something like "To suppress no-op updates > of a table, see suppress_redundant_updates_trigger." (and making that > an actual link would be a good idea). I have developed the attached patch which is in a better direction. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee --fdj2RfSjLxBAspz7 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 index 303881fcfb..7ef96c5650 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -454,7 +454,9 @@ UPDATE OF column_name1 [, column_name2BEFORE UPDATE triggers are not considered. Conversely, a command such as UPDATE ... SET x = x ... will fire a trigger on column x, even though the column's - value did not change. + value did not change; use function suppress_redundant_updates_trigger + in triggers to suppress non-change updates. --fdj2RfSjLxBAspz7--