codekingpro/portable-devtools
114k
1
2
3<!DOCTYPE html>
4
5<html lang="en" data-content_root="./">
6 <head>
7 <meta charset="utf-8" />
8 <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
9
10 <title>Trigger Dialog — pgAdmin 4 8.6 documentation</title>
11 <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
12 <link rel="stylesheet" type="text/css" href="_static/style.css?v=d36593c3" />
13
14 <script src="_static/documentation_options.js?v=d4c83366"></script>
15 <script src="_static/doctools.js?v=9a2dae69"></script>
16 <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
17
18 <script src="_static/sidebar.js"></script>
19
20 <link rel="index" title="Index" href="genindex.html" />
21 <link rel="search" title="Search" href="search.html" />
22 <link rel="next" title="Unique Constraint Dialog" href="unique_constraint_dialog.html" />
23 <link rel="prev" title="Table Dialog" href="table_dialog.html" />
24 </head><body>
25 <div class="related" role="navigation" aria-label="related navigation">
26 <h3>Navigation</h3>
27 <ul>
28 <li class="right" style="margin-right: 10px">
29 <a href="genindex.html" title="General Index"
30 accesskey="I">index</a></li>
31 <li class="right" >
32 <a href="unique_constraint_dialog.html" title="Unique Constraint Dialog"
33 accesskey="N">next</a> |</li>
34 <li class="right" >
35 <a href="table_dialog.html" title="Table Dialog"
36 accesskey="P">previous</a> |</li>
37 <li class="nav-item nav-item-0"><a href="index.html">pgAdmin 4 8.6 documentation</a> »</li>
38 <li class="nav-item nav-item-1"><a href="modifying_tables.html" accesskey="U">Creating or Modifying a Table</a> »</li>
39 <li class="nav-item nav-item-this"><a href="">Trigger Dialog</a></li>
40 </ul>
41 </div>
42
43 <div class="document">
44 <div class="documentwrapper">
45 <div class="bodywrapper">
46 <div class="body" role="main">
47
48 <section id="trigger-dialog">
49<span id="id1"></span><h1><span class="target" id="index-0"></span>Trigger Dialog<a class="headerlink" href="#trigger-dialog" title="Link to this heading">¶</a></h1>
50<p>Use the <em>Trigger</em> dialog to create a trigger or modify an existing trigger. A
51trigger executes a specified function when certain events occur.</p>
52<p>The <em>Trigger</em> dialog organizes the development of a trigger through the
53following dialog tabs: <em>General</em>, <em>Definition</em>, <em>Events</em>, and <em>Code</em>. The <em>SQL</em>
54tab displays the SQL code generated by dialog selections.</p>
55<img alt="Trigger dialog general tab" class="align-center" src="_images/trigger_general.png" />
56<p>Use the fields in the <em>General</em> tab to identify the trigger:</p>
57<ul class="simple">
58<li><p>Use the <em>Name</em> field to add a descriptive name for the trigger. This must be
59distinct from the name of any other trigger for the same table. The name will
60be displayed in the <em>pgAdmin</em> tree control. Note that if multiple triggers of
61the same kind are defined for the same event, they will be fired in
62alphabetical order by name.</p></li>
63<li><p>Store notes about the trigger in the <em>Comment</em> field.</p></li>
64</ul>
65<p>Click the <em>Definition</em> tab to continue.</p>
66<img alt="Trigger dialog definition tab" class="align-center" src="_images/trigger_definition.png" />
67<p>Use the fields in the <em>Definition</em> tab to define the trigger:</p>
68<ul class="simple">
69<li><p>Move the <em>Row trigger?</em> switch to the <em>No</em> position to disassociate the
70trigger from firing on each row in a table. The default is <em>Yes</em>.</p></li>
71<li><p>Move the <em>Constraint trigger?</em> switch to the <em>Yes</em> position to specify the
72trigger is a constraint trigger.</p></li>
73<li><p>If enabled, move the <em>Deferrable?</em> switch to the <em>Yes</em> position to specify
74the timing of the constraint trigger is deferrable and can be postponed until
75the end of the statement. The default is <em>No</em>.</p></li>
76<li><p>If enabled, move the <em>Deferred?</em> switch to the <em>Yes</em> position to specify the
77timing of the constraint trigger is deferred to the end of the statement
78causing the triggering event. The default is <em>No</em>.</p></li>
79<li><p>Use the drop-down listbox next to <em>Trigger Function</em> to select a trigger
80function or procedure.</p></li>
81<li><p>Use the <em>Arguments</em> field to provide an optional (comma-separated) list of
82arguments to the function when the trigger is executed. The arguments are
83literal string constants.</p></li>
84</ul>
85<img alt="Trigger enabled in dialog tab" class="align-center" src="_images/trigger_definition_enabled.png" />
86<ul class="simple">
87<li><p><em>Trigger enabled</em> field is available in trigger dialog once the trigger is created.
88You can select one of the four options available.</p></li>
89</ul>
90<p>Click the <em>Events</em> tab to continue.</p>
91<img alt="Trigger dialog events tab" class="align-center" src="_images/trigger_events.png" />
92<p>Use the fields in the <em>Events</em> tab to specify how and when the trigger fires:</p>
93<ul class="simple">
94<li><p>Use the drop-down listbox next to the <em>Fires</em> fields to determine if the
95trigger fires <em>BEFORE</em> or <em>AFTER</em> a specified event. The default is <em>BEFORE</em>.</p></li>
96<li><p>Select the type of event(s) that will invoke the trigger; to select an event
97type, move the switch next to the event to the <em>YES</em> position. The supported
98event types are <em>INSERT</em>, <em>UPDATE</em>, <em>DELETE</em>, and <em>TRUNCATE</em>.</p></li>
99<li><p>Use the <em>When</em> field to provide a boolean condition that will invoke the
100trigger.</p></li>
101<li><p>If defining a column-specific trigger, use the <em>Columns</em> field to specify the
102columns or columns that are the target of the trigger.</p></li>
103</ul>
104<p>Click the <em>Code</em> tab to continue.</p>
105<img alt="Trigger dialog code tab" class="align-center" src="_images/trigger_code.png" />
106<p>Use the <em>Code</em> field to specify any additional code that will be invoked when
107the trigger fires.</p>
108<p>Click the <em>SQL</em> tab to continue.</p>
109<p>Your entries in the <em>Trigger</em> dialog generate a SQL command (see an example
110below). Use the <em>SQL</em> tab for review; revisit or switch tabs to make any changes
111to the SQL command.</p>
112<section id="example">
113<h2>Example<a class="headerlink" href="#example" title="Link to this heading">¶</a></h2>
114<p>The following is an example of the sql command generated by user selections in
115the <em>Trigger</em> dialog:</p>
116<img alt="Trigger dialog sql tab" class="align-center" src="_images/trigger_sql.png" />
117<p>The example demonstrates creating a trigger named <em>emp_trigger</em>.</p>
118<ul class="simple">
119<li><p>Click the <em>Info</em> button (i) to access online help.</p></li>
120<li><p>Click the <em>Save</em> button to save work.</p></li>
121<li><p>Click the <em>Close</em> button to exit without saving work.</p></li>
122<li><p>Click the <em>Reset</em> button to restore configuration parameters.</p></li>
123</ul>
124</section>
125</section>
126
127
128 <div class="clearer"></div>
129 </div>
130 </div>
131 </div>
132 <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
133 <div class="sphinxsidebarwrapper">
134 <div>
135 <h3><a href="index.html">Table of Contents</a></h3>
136 <ul>
137<li><a class="reference internal" href="#">Trigger Dialog</a><ul>
138<li><a class="reference internal" href="#example">Example</a></li>
139</ul>
140</li>
141</ul>
142
143 </div>
144<h3><a href="index.html">Table of Contents</a></h3>
145<ul class="current">
146<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
147<li class="toctree-l1"><a class="reference internal" href="external_database.html">External database for pgAdmin user settings</a></li>
148<li class="toctree-l1"><a class="reference internal" href="connecting.html">Connecting To A Server</a></li>
149<li class="toctree-l1"><a class="reference internal" href="managing_cluster_objects.html">Managing Cluster Objects</a></li>
150<li class="toctree-l1"><a class="reference internal" href="managing_database_objects.html">Managing Database Objects</a></li>
151<li class="toctree-l1 current"><a class="reference internal" href="modifying_tables.html">Creating or Modifying a Table</a><ul class="current">
152<li class="toctree-l2"><a class="reference internal" href="check_dialog.html">Check Dialog</a></li>
153<li class="toctree-l2"><a class="reference internal" href="column_dialog.html">Column Dialog</a></li>
154<li class="toctree-l2"><a class="reference internal" href="compound_trigger_dialog.html">Compound Trigger Dialog</a></li>
155<li class="toctree-l2"><a class="reference internal" href="exclusion_constraint_dialog.html">Exclusion Constraint Dialog</a></li>
156<li class="toctree-l2"><a class="reference internal" href="foreign_key_dialog.html">Foreign key Dialog</a></li>
157<li class="toctree-l2"><a class="reference internal" href="index_dialog.html">Index Dialog</a></li>
158<li class="toctree-l2"><a class="reference internal" href="primary_key_dialog.html">Primary key Dialog</a></li>
159<li class="toctree-l2"><a class="reference internal" href="rls_policy_dialog.html">RLS Policy Dialog</a></li>
160<li class="toctree-l2"><a class="reference internal" href="rule_dialog.html">Rule Dialog</a></li>
161<li class="toctree-l2"><a class="reference internal" href="table_dialog.html">Table Dialog</a></li>
162<li class="toctree-l2 current"><a class="current reference internal" href="#">Trigger Dialog</a></li>
163<li class="toctree-l2"><a class="reference internal" href="unique_constraint_dialog.html">Unique Constraint Dialog</a></li>
164</ul>
165</li>
166<li class="toctree-l1"><a class="reference internal" href="management_basics.html">Management Basics</a></li>
167<li class="toctree-l1"><a class="reference internal" href="backup_and_restore.html">Backup and Restore</a></li>
168<li class="toctree-l1"><a class="reference internal" href="developer_tools.html">Developer Tools</a></li>
169<li class="toctree-l1"><a class="reference internal" href="processes.html">Processes</a></li>
170<li class="toctree-l1"><a class="reference internal" href="pgagent.html">pgAgent</a></li>
171<li class="toctree-l1"><a class="reference internal" href="contributions.html">pgAdmin Project Contributions</a></li>
172<li class="toctree-l1"><a class="reference internal" href="release_notes.html">Release Notes</a></li>
173<li class="toctree-l1"><a class="reference internal" href="licence.html">Licence</a></li>
174</ul>
175
176<search id="searchbox" style="display: none" role="search">
177 <h3 id="searchlabel">Quick search</h3>
178 <div class="searchformwrapper">
179 <form class="search" action="search.html" method="get">
180 <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
181 <input type="submit" value="Go" />
182 </form>
183 </div>
184</search>
185<script>document.getElementById('searchbox').style.display = "block"</script>
186 </div>
187<div id="sidebarbutton" title="Collapse sidebar">
188<span>«</span>
189</div>
190
191 </div>
192 <div class="clearer"></div>
193 </div>
194 <div class="related" role="navigation" aria-label="related navigation">
195 <h3>Navigation</h3>
196 <ul>
197 <li class="right" style="margin-right: 10px">
198 <a href="genindex.html" title="General Index"
199 >index</a></li>
200 <li class="right" >
201 <a href="unique_constraint_dialog.html" title="Unique Constraint Dialog"
202 >next</a> |</li>
203 <li class="right" >
204 <a href="table_dialog.html" title="Table Dialog"
205 >previous</a> |</li>
206 <li class="nav-item nav-item-0"><a href="index.html">pgAdmin 4 8.6 documentation</a> »</li>
207 <li class="nav-item nav-item-1"><a href="modifying_tables.html" >Creating or Modifying a Table</a> »</li>
208 <li class="nav-item nav-item-this"><a href="">Trigger Dialog</a></li>
209 </ul>
210 </div>
211 <div class="footer" role="contentinfo">
212 <div class="related" role="navigation" aria-label="related navigation">
213 <ul>
214 <li class="left" style="margin-left: 10px">© Copyright (C) 2013 - 2024, The pgAdmin Development Team.</li>
215 <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
216 <li class="right" ><a href="unique_constraint_dialog.html" title="Unique Constraint Dialog" accesskey="N">next</a> |</li>
217 <li class="right" ><a href="table_dialog.html" title="Table Dialog" accesskey="P">previous</a> |</li>
218 </ul>
219 </div>
220 </div>
221 </body>
222</html>