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 1oTjuX-00070T-Kc for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 13:07:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oTjuW-0007v8-Gn for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 13:07:08 +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 1oTjuW-0007uy-6P for pgsql-hackers@lists.postgresql.org; Thu, 01 Sep 2022 13:07:08 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTjuT-0007yq-0f for pgsql-hackers@lists.postgresql.org; Thu, 01 Sep 2022 13:07:07 +0000 Received: from msg.df7cb.de (unknown [IPv6:2003:5b:203b:100:7627:eaff:fe52:8e03]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 4MJLsz5PTKz3F19; Thu, 1 Sep 2022 15:07:03 +0200 (CEST) Date: Thu, 1 Sep 2022 15:07:03 +0200 From: Christoph Berg To: Dagfinn Ilmari =?iso-8859-1?Q?Manns=E5ker?= Cc: Daniel Gustafsson , Peter Eisentraut , PostgreSQL Hackers Subject: Re: plpgsql-trigger.html: Format TG_ variables as table (patch) Message-ID: Mail-Followup-To: Christoph Berg , Dagfinn Ilmari =?iso-8859-1?Q?Manns=E5ker?= , Daniel Gustafsson , Peter Eisentraut , PostgreSQL Hackers References: <357fec80-cb54-1455-0632-b23d844e5a68@enterprisedb.com> <877d2omr5l.fsf@wibble.ilmari.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="iXmjQlQjkYlT0qd9" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <877d2omr5l.fsf@wibble.ilmari.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --iXmjQlQjkYlT0qd9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Re: Dagfinn Ilmari Mannsåker > > Actually, just omitting the whole prefix works best. > > > > TG_WHEN (text) > > > > BEFORE, AFTER, or INSTEAD OF, depending on the trigger's definition. > > The attached patch does not reflect this, did you attach an old version? Forgot to git commit before exporting the patch, thanks for catching! > > I also shortened some "name of table" to just "table". Since the data > > type is "name", it's clear what "table" means. > > I think it reads better with the definite article and initial capital, > e.g. "The table that triggered ….". Since that's not a complete sentence anyway, I think "The" isn't necessary. > > - NEW > > + NEW (record) > > The type names should still be wrapped in , like they were before. Updated. Thanks, Christoph --iXmjQlQjkYlT0qd9 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-plpgsql-trigger.html-Use-more-concise-wording-for-TG.patch" From 9cec9ece0751910f48d56c0f0e1ac5343f6686fa Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 31 Aug 2022 11:52:50 +0200 Subject: [PATCH] plpgsql-trigger.html: Use more concise wording for TG_ variables To improve readability of the TG_ variables definition list, this moves the datatypes up to the defined term to avoid having each entry start with "Data type", and removes some more redundant clutter ("Variable holding...") from the descriptions that didn't carry any information. --- doc/src/sgml/plpgsql.sgml | 51 ++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index cf387dfc3f..985aa4d6a5 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -4032,10 +4032,10 @@ ASSERT condition , - NEW + NEW record - Data type RECORD; variable holding the new + new database row for INSERT/UPDATE operations in row-level triggers. This variable is null in statement-level triggers and for DELETE operations. @@ -4044,10 +4044,10 @@ ASSERT condition , - OLD + OLD record - Data type RECORD; variable holding the old + old database row for UPDATE/DELETE operations in row-level triggers. This variable is null in statement-level triggers and for INSERT operations. @@ -4056,20 +4056,19 @@ ASSERT condition , - TG_NAME + TG_NAME name - Data type name; variable that contains the name of the trigger actually + name of the trigger fired. - TG_WHEN + TG_WHEN text - Data type text; a string of BEFORE, AFTER, or INSTEAD OF, depending on the trigger's definition. @@ -4077,43 +4076,41 @@ ASSERT condition , - TG_LEVEL + TG_LEVEL text - Data type text; a string of either - ROW or STATEMENT + ROW or STATEMENT, depending on the trigger's definition. - TG_OP + TG_OP text - Data type text; a string of + operation for which the trigger was fired: INSERT, UPDATE, - DELETE, or TRUNCATE - telling for which operation the trigger was fired. + DELETE, or TRUNCATE. - TG_RELID + TG_RELID oid (references pg_class.oid) - Data type oid; the object ID of the table that caused the + object ID of the table that caused the trigger invocation. - TG_RELNAME + TG_RELNAME name - Data type name; the name of the table that caused the trigger + table that caused the trigger invocation. This is now deprecated, and could disappear in a future release. Use TG_TABLE_NAME instead. @@ -4121,40 +4118,40 @@ ASSERT condition , - TG_TABLE_NAME + TG_TABLE_NAME name - Data type name; the name of the table that + table that caused the trigger invocation. - TG_TABLE_SCHEMA + TG_TABLE_SCHEMA name - Data type name; the name of the schema of the + schema of the table that caused the trigger invocation. - TG_NARGS + TG_NARGS integer - Data type integer; the number of arguments given to the trigger + number of arguments given to the trigger function in the CREATE TRIGGER statement. - TG_ARGV[] + TG_ARGV text[] - Data type array of text; the arguments from + arguments from the CREATE TRIGGER statement. The index counts from 0. Invalid indexes (less than 0 or greater than or equal to tg_nargs) -- 2.35.1 --iXmjQlQjkYlT0qd9--