ALTER_TRIGGER(7pg14)
π ALTER TRIGGER(7) π
okay bestie, welcome to the PostgreSQL 14.24 Documentation page for ALTER_TRIGGER β yes, that's the manual name, and yes, we're about to make trigger edits make sense. π«Ά
πΈ NAME πΈ
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 [ NO ] DEPENDS ON EXTENSION extension_name
π¦ DESCRIPTION π¦
okay so ALTER TRIGGER changes properties of an existing trigger. Not creating one β existing. Main character behavior only. π
The RENAME clause changes the name of the given trigger without otherwise changing the trigger definition. So it's giving new name, same trigger energy. π
The DEPENDS ON EXTENSION clause marks the trigger as dependent on an extension, such that if the extension is dropped, the trigger will automatically be dropped as well. No cap, the dependency is real. β οΈ
You must own the table on which the trigger acts to be allowed to change its properties. Own the table, get the power. π
π PARAMETERS π
nameβ the name of an existing trigger to alter. It's gotta already exist, bestie.table_nameβ the name of the table on which this trigger acts.new_nameβ the new name for the trigger. Fresh name, same trigger.extension_nameβ the name of the extension that the trigger is to depend on (or no longer dependent on, ifNOis specified). A trigger that's marked as dependent on an extension is automatically dropped when the extension is dropped. So yes, if the extension goes, the trigger goes too. π«
π‘ NOTES π‘
The ability to temporarily enable or disable a trigger is provided by ALTER TABLE, 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. So if you're looking for the enable/disable switch, bestie, that's an ALTER TABLE thing. π¨
π₯ EXAMPLES π₯
To rename an existing trigger:
ALTER TRIGGER emp_stamp ON emp RENAME TO emp_track_chgs;
To mark a trigger as being dependent on an extension:
ALTER TRIGGER emp_stamp ON emp DEPENDS ON EXTENSION emplib;
π COMPATIBILITY π
ALTER TRIGGER is a PostgreSQL extension of the SQL standard. It's built different, iykyk. π
π SEE ALSO π
ALTER TABLE(ALTER_TABLE(7))
mwah π this page was served fresh with PostgreSQL 14.24, dated 2026, and it's literally titled ALTER TRIGGER(7). go own that table and slay those triggers, bestie. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms