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 1jlFhv-0005ts-A3 for pgsql-docs@arkaria.postgresql.org; Tue, 16 Jun 2020 17:49:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlFht-0000uJ-H6 for pgsql-docs@arkaria.postgresql.org; Tue, 16 Jun 2020 17:49:09 +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 1jlFht-0000uA-B7 for pgsql-docs@lists.postgresql.org; Tue, 16 Jun 2020 17:49:09 +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 1jlFhq-0000Rq-Li for pgsql-docs@lists.postgresql.org; Tue, 16 Jun 2020 17:49:08 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jlFho-0004OU-Lw; Tue, 16 Jun 2020 13:49:04 -0400 Date: Tue, 16 Jun 2020 13:49:04 -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: <20200616174904.GC12171@momjian.us> References: <159195294959.673.5752624528747900508@wrigleys.postgresql.org> <20200616103644.GE31175@momjian.us> <1300920.1592316494@sss.pgh.pa.us> <20200616164108.GA12171@momjian.us> <1369890.1592329185@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0eh6TmSyL6TZE2Uz" Content-Disposition: inline In-Reply-To: <1369890.1592329185@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 --0eh6TmSyL6TZE2Uz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 16, 2020 at 01:39:45PM -0400, Tom Lane wrote: > Bruce Momjian writes: > > I have developed the attached patch which is in a better direction. > > I still wish you wouldn't jam this topic into an only-marginally-related > sentence. In the case at hand, the point that the existing text is > making is that a no-op update will fire triggers. Which is not > something that suppress_redundant_updates_trigger will suppress, > so again it seems confusing to mention that in the same breath. > > I think that perhaps the right thing to do is add a new para to > CREATE TRIGGER's "Notes" section, along the lines of > > There are a few built-in trigger functions that can be used > to solve common problems without having to write your own trigger > code. See Section 9.28. > > This would have the advantage of covering the other built-in triggers > not only suppress_redundant_updates_trigger. OK, I didn't think there was enough desire to put it its own paragraph, but I like the idea of mentioning all of the trigger functions; patch attached. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee --0eh6TmSyL6TZE2Uz 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..289dd1d9da 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -457,6 +457,12 @@ UPDATE OF column_name1 [, column_name2 + + There are a few built-in trigger functions that can be used to + solve common problems without having to write your own trigger code; + see . + + In a BEFORE trigger, the WHEN condition is evaluated just before the function is or would be executed, so using --0eh6TmSyL6TZE2Uz--