Re: To Daniel Gustafsson
> "string containing" is again pretty boilerplatish, how about just
> "contains"?
Actually, just omitting the whole prefix works best.
TG_WHEN (text)
BEFORE, AFTER, or INSTEAD OF, depending on the trigger's definition.
I also shortened some "name of table" to just "table". Since the data
type is "name", it's clear what "table" means.
Christoph
>From a281bbb3ba80e14645f83d464ca6df892a85c1bb Mon Sep 17 00:00:00 2001
From: Christoph Berg <[email protected]>
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 | 52 +++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index cf387dfc3f..b5cfe3c63d 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> (record)</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> (record)</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,20 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
</varlistentry>
<varlistentry>
- <term><varname>TG_NAME</varname></term>
+ <term><varname>TG_NAME</varname> (name)</term>
<listitem>
<para>
- Data type <type>name</type>; variable that contains the name of the trigger actually
+ name of the trigger actually
fired.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><varname>TG_WHEN</varname></term>
+ <term><varname>TG_WHEN</varname> (text)</term>
<listitem>
<para>
- Data type <type>text</type>; a string of
+ contains
<literal>BEFORE</literal>, <literal>AFTER</literal>, or
<literal>INSTEAD OF</literal>, depending on the trigger's definition.
</para>
@@ -4077,43 +4077,43 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
</varlistentry>
<varlistentry>
- <term><varname>TG_LEVEL</varname></term>
+ <term><varname>TG_LEVEL</varname> (text)</term>
<listitem>
<para>
- Data type <type>text</type>; a string of either
- <literal>ROW</literal> or <literal>STATEMENT</literal>
+ contains
+ <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> (text)</term>
<listitem>
<para>
- Data type <type>text</type>; a string of
+ contains
<literal>INSERT</literal>, <literal>UPDATE</literal>,
- <literal>DELETE</literal>, or <literal>TRUNCATE</literal>
+ <literal>DELETE</literal>, or <literal>TRUNCATE</literal>,
telling for which operation the trigger was fired.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><varname>TG_RELID</varname></term>
+ <term><varname>TG_RELID</varname> (oid, 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> (name)</term>
<listitem>
<para>
- Data type <type>name</type>; the name of the table that caused the trigger
+ name of the 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 +4121,40 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
</varlistentry>
<varlistentry>
- <term><varname>TG_TABLE_NAME</varname></term>
+ <term><varname>TG_TABLE_NAME</varname> (name)</term>
<listitem>
<para>
- Data type <type>name</type>; the name of the table that
+ name of the table that
caused the trigger invocation.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><varname>TG_TABLE_SCHEMA</varname></term>
+ <term><varname>TG_TABLE_SCHEMA</varname> (name)</term>
<listitem>
<para>
- Data type <type>name</type>; the name of the schema of the
+ name 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> (integer)</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> (text[])</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>)
--
2.35.1