Home Explore Blog CI



postgresql

98th chunk of `doc/src/sgml/catalogs.sgml`
0a0dcabe54b13c05f1ca53302301e9a15107587be5692ace0000000100000ffe
 triggers on tables
   and views.
   See <xref linkend="sql-createtrigger"/>
   for more information.
  </para>

  <table>
   <title><structname>pg_trigger</structname> Columns</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>oid</structfield> <type>oid</type>
      </para>
      <para>
       Row identifier
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgrelid</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       The table this trigger is on
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgparentid</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       Parent trigger that this trigger is cloned from (this happens when
       partitions are created or attached to a partitioned table);
       zero if not a clone
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgname</structfield> <type>name</type>
      </para>
      <para>
       Trigger name (must be unique among triggers of same table)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgfoid</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       The function to be called
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgtype</structfield> <type>int2</type>
      </para>
      <para>
       Bit mask identifying trigger firing conditions
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgenabled</structfield> <type>char</type>
      </para>
      <para>
       Controls in which <xref linkend="guc-session-replication-role"/> modes
       the trigger fires.
       <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
       <literal>D</literal> = trigger is disabled,
       <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
       <literal>A</literal> = trigger fires always.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgisinternal</structfield> <type>bool</type>
      </para>
      <para>
       True if trigger is internally generated (usually, to enforce
       the constraint identified by <structfield>tgconstraint</structfield>)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgconstrrelid</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       The table referenced by a referential integrity constraint
       (zero if trigger is not for a referential integrity constraint)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tgconstrindid</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)

Title: pg_trigger Catalog
Summary
This section describes the `pg_trigger` catalog, which stores information about triggers on tables and views. It includes details such as the table the trigger is on (`tgrelid`), the parent trigger if it's a clone (`tgparentid`), the trigger's name (`tgname`), the function to be called (`tgfoid`), the firing conditions (`tgtype`), its enabled state based on replication role (`tgenabled`), whether it's internally generated (`tgisinternal`), and information related to referential integrity constraints (`tgconstrrelid`, `tgconstrindid`).