Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit130b2dd

Browse files
committed
Add documentation for ALTER TABLE ENABLE/DISABLE TRIGGER.
1 parent249a720 commit130b2dd

File tree

3 files changed

+87
-8
lines changed

3 files changed

+87
-8
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
Documentation of the system catalogs, directed toward PostgreSQL developers
3-
$PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.111 2005/08/11 21:11:41 tgl Exp $
3+
$PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.112 2005/08/24 17:24:17 tgl Exp $
44
-->
55

66
<chapter id="catalogs">
@@ -3789,9 +3789,7 @@
37893789
<entry><structfield>tgenabled</structfield></entry>
37903790
<entry><type>bool</type></entry>
37913791
<entry></entry>
3792-
<entry>True if trigger is enabled (not presently checked everywhere
3793-
it should be, so disabling a trigger by setting this false does not
3794-
work reliably)</entry>
3792+
<entry>True if trigger is enabled</entry>
37953793
</row>
37963794

37973795
<row>

‎doc/src/sgml/ref/alter_table.sgml

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.80 2005/08/22 21:32:01 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.81 2005/08/24 17:24:19 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -41,6 +41,8 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
4141
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
4242
ADD <replaceable class="PARAMETER">table_constraint</replaceable>
4343
DROP CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> [ RESTRICT | CASCADE ]
44+
DISABLE TRIGGER [ <replaceable class="PARAMETER">trigger_name</replaceable> | ALL | USER ]
45+
ENABLE TRIGGER [ <replaceable class="PARAMETER">trigger_name</replaceable> | ALL | USER ]
4446
CLUSTER ON <replaceable class="PARAMETER">index_name</replaceable>
4547
SET WITHOUT CLUSTER
4648
SET WITHOUT OIDS
@@ -189,6 +191,25 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
189191
</listitem>
190192
</varlistentry>
191193

194+
<varlistentry>
195+
<term><literal>DISABLE</literal>/<literal>ENABLE TRIGGER</literal></term>
196+
<listitem>
197+
<para>
198+
These forms disable or enable trigger(s) belonging to the table.
199+
A disabled trigger is still known to the system, but is not executed
200+
when its triggering event occurs. For a deferred trigger, the enable
201+
status is checked when the event occurs, not when the trigger function
202+
is actually executed. One may disable or enable a single
203+
trigger specified by name, or all triggers on the table, or only
204+
user triggers (this option excludes triggers that are used to implement
205+
foreign key constraints). Disabling or enabling constraint triggers
206+
requires superuser privileges; it should be done with caution since
207+
of course the integrity of the constraint cannot be guaranteed if the
208+
triggers are not executed.
209+
</para>
210+
</listitem>
211+
</varlistentry>
212+
192213
<varlistentry>
193214
<term><literal>CLUSTER</literal></term>
194215
<listitem>
@@ -292,8 +313,11 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
292313
You must own the table to use <command>ALTER TABLE</>.
293314
To change the schema of a table, you must also have
294315
<literal>CREATE</literal> privilege on the new schema.
295-
To alter the owner, the new owner must have
296-
<literal>CREATE</literal> privilege on the schema.
316+
To alter the owner, you must also be a direct or indirect member of the new
317+
owning role, and that role must have <literal>CREATE</literal> privilege on
318+
the table's schema. (These restrictions enforce that altering the owner
319+
doesn't do anything you couldn't do by dropping and recreating the table.
320+
However, a superuser can alter ownership of any table anyway.)
297321
</para>
298322
</refsect1>
299323

@@ -394,6 +418,36 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
394418
</listitem>
395419
</varlistentry>
396420

421+
<varlistentry>
422+
<term><replaceable class="PARAMETER">trigger_name</replaceable></term>
423+
<listitem>
424+
<para>
425+
Name of a single trigger to disable or enable.
426+
</para>
427+
</listitem>
428+
</varlistentry>
429+
430+
<varlistentry>
431+
<term><literal>ALL</literal></term>
432+
<listitem>
433+
<para>
434+
Disable or enable all triggers belonging to the table.
435+
(This requires superuser privilege if any of the triggers are for
436+
foreign key constraints.)
437+
</para>
438+
</listitem>
439+
</varlistentry>
440+
441+
<varlistentry>
442+
<term><literal>USER</literal></term>
443+
<listitem>
444+
<para>
445+
Disable or enable all triggers belonging to the table except for
446+
foreign key constraint triggers.
447+
</para>
448+
</listitem>
449+
</varlistentry>
450+
397451
<varlistentry>
398452
<term><replaceable class="PARAMETER">index_name</replaceable></term>
399453
<listitem>
@@ -524,6 +578,13 @@ ALTER TABLE table ALTER COLUMN anycol TYPE anytype;
524578
instead marks them as independently defined rather than inherited.
525579
</para>
526580

581+
<para>
582+
The <literal>TRIGGER</>, <literal>CLUSTER</>, <literal>OWNER</>,
583+
and <literal>TABLESPACE</> actions never recurse to descendant tables;
584+
that is, they always act as though <literal>ONLY</> were specified.
585+
Adding a constraint can recurse only for <literal>CHECK</> constraints.
586+
</para>
587+
527588
<para>
528589
Changing any part of a system catalog table is not permitted.
529590
</para>

‎doc/src/sgml/ref/alter_trigger.sgml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_trigger.sgml,v 1.8 2003/11/29 19:51:38 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_trigger.sgml,v 1.9 2005/08/24 17:24:19 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -72,6 +72,18 @@ ALTER TRIGGER <replaceable class="PARAMETER">name</replaceable> ON <replaceable
7272
</variablelist>
7373
</refsect1>
7474

75+
<refsect1>
76+
<title>Notes</title>
77+
78+
<para>
79+
The ability to temporarily enable or disable a trigger is provided by
80+
<xref linkend="SQL-ALTERTABLE" endterm="SQL-ALTERTABLE-TITLE">, not by
81+
<command>ALTER TRIGGER</>, because <command>ALTER TRIGGER</> has no
82+
convenient way to express the option of enabling or disabling all of
83+
a table's triggers at once.
84+
</para>
85+
</refsect1>
86+
7587
<refsect1>
7688
<title>Examples</title>
7789

@@ -91,6 +103,14 @@ ALTER TRIGGER emp_stamp ON emp RENAME TO emp_track_chgs;
91103
extension of the SQL standard.
92104
</para>
93105
</refsect1>
106+
107+
<refsect1>
108+
<title>See Also</title>
109+
110+
<simplelist type="inline">
111+
<member><xref linkend="sql-altertable" endterm="sql-altertable-title"></member>
112+
</simplelist>
113+
</refsect1>
94114
</refentry>
95115

96116
<!-- Keep this comment at the end of the file

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp