ALTER_TRIGGER(7pg17)
π NAME π
okay so bestie, welcome to the ALTER_TRIGGER page β the one thatβs here to change the definition of a trigger. Thatβs literally the whole assignment. β¨
β¨ SYNOPSIS β¨
ALTER TRIGGER name ON table_name RENAME TO new_name
ALTER TRIGGER name ON table_name [ NO ] DEPENDS ON EXTENSION extension_name
π DESCRIPTION π
ALTER TRIGGER changes properties of an existing trigger. Not making a new one, just giving the existing one a little edit. π«Ά
The RENAME clause changes the name of the given trigger without otherwise changing the trigger definition. If the table that the trigger is on is a partitioned table, then corresponding clone triggers in the partitions are renamed too. Slay, clones included. π
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. So yeah, that attachment is real β extension goes bye, trigger goes bye too. π
You must own the table on which the trigger acts to be allowed to change its properties. Own the table, get the edit privileges. periodt. π
π PARAMETERS π
nameβ the name of an existing trigger to alter. The trigger in question, bestie.table_nameβ the name of the table on which this trigger acts.new_nameβ the new name for the trigger. The glow-up name. β¨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.
π¦ 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 on/off switch, itβs giving ALTER TABLE energy, not ALTER TRIGGER. π¦
π₯ 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. So itβs PostgreSQLβs own special little move. π
π SEE ALSO π
ALTER TABLEβ thatβs theALTER_TABLE(7)page, bestie. Go read it if you need the table-level stuff. π
π sign-off: this page is sourced from PostgreSQL 17.11, dated 2026. mwah, periodt. π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-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