From 130b2dd8ead85b9ee74de1e55d233ecbaf22c55d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 24 Aug 2005 17:24:19 +0000 Subject: [PATCH] Add documentation for ALTER TABLE ENABLE/DISABLE TRIGGER. --- doc/src/sgml/catalogs.sgml | 6 +-- doc/src/sgml/ref/alter_table.sgml | 67 +++++++++++++++++++++++++++-- doc/src/sgml/ref/alter_trigger.sgml | 22 +++++++++- 3 files changed, 87 insertions(+), 8 deletions(-) diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index f938a27bb91..6260c25445a 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1,6 +1,6 @@ @@ -3789,9 +3789,7 @@ tgenabled bool - True if trigger is enabled (not presently checked everywhere - it should be, so disabling a trigger by setting this false does not - work reliably) + True if trigger is enabled diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index c302e4f1157..a588f847cef 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1,5 +1,5 @@ @@ -41,6 +41,8 @@ where action is one of: ALTER [ COLUMN ] column SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } ADD table_constraint DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ] + DISABLE TRIGGER [ trigger_name | ALL | USER ] + ENABLE TRIGGER [ trigger_name | ALL | USER ] CLUSTER ON index_name SET WITHOUT CLUSTER SET WITHOUT OIDS @@ -189,6 +191,25 @@ where action is one of: + + DISABLE/ENABLE TRIGGER + + + These forms disable or enable trigger(s) belonging to the table. + A disabled trigger is still known to the system, but is not executed + when its triggering event occurs. For a deferred trigger, the enable + status is checked when the event occurs, not when the trigger function + is actually executed. One may disable or enable a single + trigger specified by name, or all triggers on the table, or only + user triggers (this option excludes triggers that are used to implement + foreign key constraints). Disabling or enabling constraint triggers + requires superuser privileges; it should be done with caution since + of course the integrity of the constraint cannot be guaranteed if the + triggers are not executed. + + + + CLUSTER @@ -292,8 +313,11 @@ where action is one of: You must own the table to use ALTER TABLE. To change the schema of a table, you must also have CREATE privilege on the new schema. - To alter the owner, the new owner must have - CREATE privilege on the schema. + To alter the owner, you must also be a direct or indirect member of the new + owning role, and that role must have CREATE privilege on + the table's schema. (These restrictions enforce that altering the owner + doesn't do anything you couldn't do by dropping and recreating the table. + However, a superuser can alter ownership of any table anyway.) @@ -394,6 +418,36 @@ where action is one of: + + trigger_name + + + Name of a single trigger to disable or enable. + + + + + + ALL + + + Disable or enable all triggers belonging to the table. + (This requires superuser privilege if any of the triggers are for + foreign key constraints.) + + + + + + USER + + + Disable or enable all triggers belonging to the table except for + foreign key constraint triggers. + + + + index_name @@ -524,6 +578,13 @@ ALTER TABLE table ALTER COLUMN anycol TYPE anytype; instead marks them as independently defined rather than inherited. + + The TRIGGER, CLUSTER, OWNER, + and TABLESPACE actions never recurse to descendant tables; + that is, they always act as though ONLY were specified. + Adding a constraint can recurse only for CHECK constraints. + + Changing any part of a system catalog table is not permitted. diff --git a/doc/src/sgml/ref/alter_trigger.sgml b/doc/src/sgml/ref/alter_trigger.sgml index df9772b2409..8436717ba5a 100644 --- a/doc/src/sgml/ref/alter_trigger.sgml +++ b/doc/src/sgml/ref/alter_trigger.sgml @@ -1,5 +1,5 @@ @@ -72,6 +72,18 @@ ALTER TRIGGER name ON + + Notes + + + The ability to temporarily enable or disable a trigger is provided by + , not by + ALTER TRIGGER, because ALTER TRIGGER has no + convenient way to express the option of enabling or disabling all of + a table's triggers at once. + + + Examples @@ -91,6 +103,14 @@ ALTER TRIGGER emp_stamp ON emp RENAME TO emp_track_chgs; extension of the SQL standard. + + + See Also + + + + +