1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>31.37.triggers</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="information-schema.html" title="Chapter31.The Information Schema">
<link rel="prev" href="infoschema-tables.html" title="31.36.tables">
<link rel="next" href="infoschema-usage-privileges.html" title="31.38.usage_privileges">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="infoschema-triggers"></a>31.37.<code class="literal">triggers</code></h2></div></div></div>
<p> The view <code class="literal">triggers</code> contains all triggers defined
in the current database that are owned by the current user. (The
owner of the table is the owner of the trigger.)
</p>
<div class="table">
<a name="id702240"></a><p class="title"><b>Table31.35.<code class="literal">triggers</code> Columns</b></p>
<div class="table-contents"><table summary="triggers Columns" border="1">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code class="literal">trigger_catalog</code></td>
<td><code class="type">sql_identifier</code></td>
<td>Name of the database that contains the trigger (always the current database)</td>
</tr>
<tr>
<td><code class="literal">trigger_schema</code></td>
<td><code class="type">sql_identifier</code></td>
<td>Name of the schema that contains the trigger</td>
</tr>
<tr>
<td><code class="literal">trigger_name</code></td>
<td><code class="type">sql_identifier</code></td>
<td>Name of the trigger</td>
</tr>
<tr>
<td><code class="literal">event_manipulation</code></td>
<td><code class="type">character_data</code></td>
<td> Event that fires the trigger (<code class="literal">INSERT</code>,
<code class="literal">UPDATE</code>, or <code class="literal">DELETE</code>)
</td>
</tr>
<tr>
<td><code class="literal">event_object_catalog</code></td>
<td><code class="type">sql_identifier</code></td>
<td> Name of the database that contains the table that the trigger
is defined on (always the current database)
</td>
</tr>
<tr>
<td><code class="literal">event_object_schema</code></td>
<td><code class="type">sql_identifier</code></td>
<td>Name of the schema that contains the table that the trigger is defined on</td>
</tr>
<tr>
<td><code class="literal">event_object_table</code></td>
<td><code class="type">sql_identifier</code></td>
<td>Name of the table that the trigger is defined on</td>
</tr>
<tr>
<td><code class="literal">action_order</code></td>
<td><code class="type">cardinal_number</code></td>
<td>Not yet implemented</td>
</tr>
<tr>
<td><code class="literal">action_condition</code></td>
<td><code class="type">character_data</code></td>
<td>Applies to a feature not available in <span class="productname">PostgreSQL</span>
</td>
</tr>
<tr>
<td><code class="literal">action_statement</code></td>
<td><code class="type">character_data</code></td>
<td> Statement that is executed by the trigger (currently always
<code class="literal">EXECUTE PROCEDURE
<em class="replaceable"><code>function</code></em>(...)</code>)
</td>
</tr>
<tr>
<td><code class="literal">action_orientation</code></td>
<td><code class="type">character_data</code></td>
<td> Identifies whether the trigger fires once for each processed
row or once for each statement (<code class="literal">ROW</code> or
<code class="literal">STATEMENT</code>)
</td>
</tr>
<tr>
<td><code class="literal">condition_timing</code></td>
<td><code class="type">character_data</code></td>
<td> Time at which the trigger fires (<code class="literal">BEFORE</code> or
<code class="literal">AFTER</code>)
</td>
</tr>
<tr>
<td><code class="literal">condition_reference_old_table</code></td>
<td><code class="type">sql_identifier</code></td>
<td>Applies to a feature not available in <span class="productname">PostgreSQL</span>
</td>
</tr>
<tr>
<td><code class="literal">condition_reference_new_table</code></td>
<td><code class="type">sql_identifier</code></td>
<td>Applies to a feature not available in <span class="productname">PostgreSQL</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p> Triggers in <span class="productname">PostgreSQL</span> have two
incompatibilities with the SQL standard that affect the
representation in the information schema. First, trigger names are
local to the table in <span class="productname">PostgreSQL</span>, rather
than being independent schema objects. Therefore there may be duplicate
trigger names defined in one schema, as long as they belong to
different tables. (<code class="literal">trigger_catalog</code> and
<code class="literal">trigger_schema</code> are really the values pertaining
to the table that the trigger is defined on.) Second, triggers can
be defined to fire on multiple events in
<span class="productname">PostgreSQL</span> (e.g., <code class="literal">ON INSERT OR
UPDATE</code>), whereas the SQL standard only allows one. If a
trigger is defined to fire on multiple events, it is represented as
multiple rows in the information schema, one for each type of
event. As a consequence of these two issues, the primary key of
the view <code class="literal">triggers</code> is really
<code class="literal">(trigger_catalog, trigger_schema, trigger_name,
event_object_table, event_manipulation)</code> instead of
<code class="literal">(trigger_catalog, trigger_schema, trigger_name)</code>,
which is what the SQL standard specifies. Nonetheless, if you
define your triggers in a manner that conforms with the SQL
standard (trigger names unique in the schema and only one event
type per trigger), this will not affect you.
</p>
</div></body>
</html>
|