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 1jl8xW-0007UA-Q5 for pgsql-docs@arkaria.postgresql.org; Tue, 16 Jun 2020 10:36:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jl8xU-0002Is-Tx for pgsql-docs@arkaria.postgresql.org; Tue, 16 Jun 2020 10:36:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jl8xU-0002Hw-Nz for pgsql-docs@lists.postgresql.org; Tue, 16 Jun 2020 10:36:48 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jl8xR-0004c3-Se for pgsql-docs@lists.postgresql.org; Tue, 16 Jun 2020 10:36:48 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jl8xQ-0002Rw-4v; Tue, 16 Jun 2020 06:36:44 -0400 Date: Tue, 16 Jun 2020 06:36:44 -0400 From: Bruce Momjian To: petermpallesen@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Not using suppress_redundant_updates_trigger in sql-createtrigger.html#examples Message-ID: <20200616103644.GE31175@momjian.us> References: <159195294959.673.5752624528747900508@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2B/JsCI69OhZNC5r" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <159195294959.673.5752624528747900508@wrigleys.postgresql.org> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --2B/JsCI69OhZNC5r Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Fri, Jun 12, 2020 at 09:09:09AM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/12/bug-reporting.html > Description: > > Hi > I was stumbling across the trigger function > ‘suppress_redundant_updates_trigger’ in > https://www.postgresql.org/docs/devel/functions-trigger.html and I would > just ask if there is any reason of this not being int the documentation in > https://www.postgresql.org/docs/13/sql-createtrigger.html. > So after > > Call a function to log updates of accounts, but only if something changed: > > CREATE TRIGGER log_update > AFTER UPDATE ON accounts > FOR EACH ROW > WHEN (OLD.* IS DISTINCT FROM NEW.*) > EXECUTE FUNCTION log_account_update(); > > There could be an alternative implementation as well > > CREATE TRIGGER log_update > AFTER UPDATE ON accounts > FOR EACH ROW > EXECUTE FUNCTION log_account_update(); > > CREATE TRIGGER suppress_redundant_account_after_updates > AFTER UPDATE ON accounts > FOR EACH ROW EXECUTE FUNCTION suppress_redundant_updates_trigger(); > > > Just to introduce and like the feature. > > Thank you for your great work best regards 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. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee --2B/JsCI69OhZNC5r 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..8cfac0fbc6 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -582,7 +582,9 @@ CREATE TRIGGER check_update Call a function to log updates of accounts, but only if - something changed: + something changed + (suppress_redundant_updates_trigger() can also be + helpful here): CREATE TRIGGER log_update --2B/JsCI69OhZNC5r--