From: Bruce Momjian <bruce@momjian.us>
To: petermpallesen@gmail.com
To: pgsql-docs@lists.postgresql.org
Subject: Re: Not using suppress_redundant_updates_trigger in sql-createtrigger.html#examples
Date: Tue, 16 Jun 2020 06:36:44 -0400
Message-ID: <20200616103644.GE31175@momjian.us> (raw)
In-Reply-To: <159195294959.673.5752624528747900508@wrigleys.postgresql.org>
References: <159195294959.673.5752624528747900508@wrigleys.postgresql.org>
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 <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
Attachments:trigger.diff (text/x-diff, 544B) downloaddiff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgmlindex 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
</programlisting>
Call a function to log updates of <literal>accounts</literal>, but only if
- something changed:+ something changed+ (<function>suppress_redundant_updates_trigger()</function> can also be+ helpful here):
<programlisting>
CREATE TRIGGER log_update
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: bruce@momjian.us, petermpallesen@gmail.com, pgsql-docs@lists.postgresql.org
Subject: Re: Not using suppress_redundant_updates_trigger in sql-createtrigger.html#examples
In-Reply-To: <20200616103644.GE31175@momjian.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox