Skip to main content
Version: 1.0.16

ALTER TRIGGER

ALTER TRIGGER — Change the Definition of a Trigger

Synopsis

ALTER TRIGGER name ON table_name RENAME TO new_name

ALTER TRIGGER name ON table_name DEPENDS ON EXTENSION extension_name

Description

ALTER TRIGGER changes the properties of an existing trigger. The RENAME clause changes the name of the given trigger without changing its definition. The DEPENDS ON EXTENSION clause marks the trigger as dependent on an extension, so that if the extension is dropped, the trigger will be automatically dropped as well.

You must own the table that the trigger acts on to change its properties.

Parameters

name

The name of an existing trigger to modify.

table_name

The name of the table on which this trigger acts.

new_name

The new name of the trigger.

extension_name

The name of the extension on which the trigger depends (or if NO is specified, no longer depends). Triggers marked as dependent on an extension are automatically dropped when the extension is dropped.

Notes

The ability to temporarily enable or disable a trigger is provided by ALTER TABLE rather than ALTER TRIGGER, because ALTER TRIGGER has no option to enable or disable all triggers on a table at once.

Examples

# To rename an existing trigger:

ALTER TRIGGER emp_stamp ON emp RENAME TO emp_track_chgs;

# To mark a trigger as dependent on an extension:

ALTER TRIGGER emp_stamp ON emp DEPENDS ON EXTENSION emplib;

See Also

ALTER TABLE