Home Explore Blog CI



postgresql

1st chunk of `doc/src/sgml/ref/create_event_trigger.sgml`
7d099994a342c0011e58d4153c8f1a4dcc3a1a973803cdb10000000100000a4f
<!--
doc/src/sgml/ref/create_event_trigger.sgml
PostgreSQL documentation
-->

<refentry id="sql-createeventtrigger">
 <indexterm zone="sql-createeventtrigger">
  <primary>CREATE EVENT TRIGGER</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>CREATE EVENT TRIGGER</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>CREATE EVENT TRIGGER</refname>
  <refpurpose>define a new event trigger</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
<synopsis>
CREATE EVENT TRIGGER <replaceable class="parameter">name</replaceable>
    ON <replaceable class="parameter">event</replaceable>
    [ WHEN <replaceable class="parameter">filter_variable</replaceable> IN (<replaceable class="parameter">filter_value</replaceable> [, ... ]) [ AND ... ] ]
    EXECUTE { FUNCTION | PROCEDURE } <replaceable class="parameter">function_name</replaceable>()
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>CREATE EVENT TRIGGER</command> creates a new event trigger.
   Whenever the designated event occurs and the <literal>WHEN</literal> condition
   associated with the trigger, if any, is satisfied, the trigger function
   will be executed.  For a general introduction to event triggers, see
   <xref linkend="event-triggers"/>.  The user who creates an event trigger
   becomes its owner.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
   <varlistentry>
    <term><replaceable class="parameter">name</replaceable></term>
    <listitem>
     <para>
      The name to give the new trigger.  This name must be unique within
      the database.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">event</replaceable></term>
    <listitem>
     <para>
      The name of the event that triggers a call to the given function.
      See <xref linkend="event-trigger-definition"/> for more information
      on event names.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">filter_variable</replaceable></term>
    <listitem>
     <para>
      The name of a variable used to filter events.  This makes it possible
      to restrict the firing of the trigger to a subset of the cases in which
      it is supported.  Currently the only supported
      <replaceable class="parameter">filter_variable</replaceable>
      is <literal>TAG</literal>.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">filter_value</replaceable></term>
  

Title: CREATE EVENT TRIGGER: Define a New Event Trigger
Summary
The CREATE EVENT TRIGGER command creates a new event trigger. The trigger executes a specified function when a designated event occurs and its associated WHEN condition is met. The user creating the trigger becomes its owner. The syntax includes specifying a unique name, the event to trigger on, optional filter variables (currently only TAG is supported), and the function to execute.