From 25b8be9f1f3ad499364be2a7ca506e6a26074fb4 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <daniel@yesql.se>
Date: Fri, 2 Sep 2022 11:07:54 +0200
Subject: [PATCH v2] doc: Use more concise wording for pl/pgSQL TG_ variables
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

To improve readability of the TG_ variables definition lists, this moves
the datatypes up to the defined term to avoid having each entry start
with "Data type". This also removes redundant wording that that didn't
carry any information from the descriptions.

Author: Christoph Berg <myon@debian.org>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/Yw4Noe3A2s87A0qq@msg.df7cb.de
---
 doc/src/sgml/plpgsql.sgml | 61 ++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 33 deletions(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index cf387dfc3f..86bc32ae88 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -4032,10 +4032,10 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
 
    <variablelist>
     <varlistentry>
-     <term><varname>NEW</varname></term>
+     <term><varname>NEW</varname> <type>record</type></term>
      <listitem>
       <para>
-       Data type <type>RECORD</type>; variable holding the new
+       new
        database row for <command>INSERT</command>/<command>UPDATE</command> operations in row-level
        triggers. This variable is null in statement-level triggers
        and for <command>DELETE</command> operations.
@@ -4044,10 +4044,10 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
     </varlistentry>
 
     <varlistentry>
-     <term><varname>OLD</varname></term>
+     <term><varname>OLD</varname> <type>record</type></term>
      <listitem>
       <para>
-       Data type <type>RECORD</type>; variable holding the old
+       old
        database row for <command>UPDATE</command>/<command>DELETE</command> operations in row-level
        triggers. This variable is null in statement-level triggers
        and for <command>INSERT</command> operations.
@@ -4056,20 +4056,19 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_NAME</varname></term>
+     <term><varname>TG_NAME</varname> <type>name</type></term>
      <listitem>
       <para>
-       Data type <type>name</type>; variable that contains the name of the trigger actually
+       name of the trigger
        fired.
       </para>
      </listitem>
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_WHEN</varname></term>
+     <term><varname>TG_WHEN</varname> <type>text</type></term>
      <listitem>
       <para>
-       Data type <type>text</type>; a string of
        <literal>BEFORE</literal>, <literal>AFTER</literal>, or
        <literal>INSTEAD OF</literal>, depending on the trigger's definition.
       </para>
@@ -4077,43 +4076,41 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_LEVEL</varname></term>
+     <term><varname>TG_LEVEL</varname> <type>text</type></term>
      <listitem>
       <para>
-       Data type <type>text</type>; a string of either
-       <literal>ROW</literal> or <literal>STATEMENT</literal>
+       <literal>ROW</literal> or <literal>STATEMENT</literal>,
        depending on the trigger's definition.
       </para>
      </listitem>
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_OP</varname></term>
+     <term><varname>TG_OP</varname> <type>text</type></term>
      <listitem>
       <para>
-       Data type <type>text</type>; a string of
+       operation for which the trigger was fired:
        <literal>INSERT</literal>, <literal>UPDATE</literal>,
-       <literal>DELETE</literal>, or <literal>TRUNCATE</literal>
-       telling for which operation the trigger was fired.
+       <literal>DELETE</literal>, or <literal>TRUNCATE</literal>.
       </para>
      </listitem>
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_RELID</varname></term>
+     <term><varname>TG_RELID</varname> <type>oid</type> (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)</term>
      <listitem>
       <para>
-       Data type <type>oid</type>; the object ID of the table that caused the
+       object ID of the table that caused the
        trigger invocation.
       </para>
      </listitem>
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_RELNAME</varname></term>
+     <term><varname>TG_RELNAME</varname> <type>name</type></term>
      <listitem>
       <para>
-       Data type <type>name</type>; 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 <literal>TG_TABLE_NAME</literal> instead.
       </para>
@@ -4121,40 +4118,40 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_TABLE_NAME</varname></term>
+     <term><varname>TG_TABLE_NAME</varname> <type>name</type></term>
      <listitem>
       <para>
-       Data type <type>name</type>; the name of the table that
+       table that
        caused the trigger invocation.
       </para>
      </listitem>
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_TABLE_SCHEMA</varname></term>
+     <term><varname>TG_TABLE_SCHEMA</varname> <type>name</type></term>
      <listitem>
       <para>
-       Data type <type>name</type>; the name of the schema of the
+       schema of the
        table that caused the trigger invocation.
       </para>
      </listitem>
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_NARGS</varname></term>
+     <term><varname>TG_NARGS</varname> <type>integer</type></term>
      <listitem>
       <para>
-       Data type <type>integer</type>; the number of arguments given to the trigger
+       number of arguments given to the trigger
        function in the <command>CREATE TRIGGER</command> statement.
       </para>
      </listitem>
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_ARGV[]</varname></term>
+     <term><varname>TG_ARGV</varname> <type>text[]</type></term>
      <listitem>
       <para>
-       Data type array of <type>text</type>; the arguments from
+       arguments from
        the <command>CREATE TRIGGER</command> statement.
        The index counts from 0. Invalid
        indexes (less than 0 or greater than or equal to <varname>tg_nargs</varname>)
@@ -4656,21 +4653,19 @@ CREATE TRIGGER emp_audit_del
 
    <variablelist>
     <varlistentry>
-     <term><varname>TG_EVENT</varname></term>
+     <term><varname>TG_EVENT</varname> <type>text</type></term>
      <listitem>
       <para>
-       Data type <type>text</type>; a string representing the event the
-       trigger is fired for.
+       event the trigger is fired for.
       </para>
      </listitem>
     </varlistentry>
 
     <varlistentry>
-     <term><varname>TG_TAG</varname></term>
+     <term><varname>TG_TAG</varname> <type>text</type></term>
      <listitem>
       <para>
-       Data type <type>text</type>; variable that contains the command tag
-       for which the trigger is fired.
+       command tag for which the trigger is fired.
       </para>
      </listitem>
     </varlistentry>
-- 
2.32.1 (Apple Git-133)

