ALTER_TRIGGER(7pg15)
π ALTER_TRIGGER (PostgreSQL 15.19, section 7) π
okay bestie, this is the ALTER_TRIGGER page from the PostgreSQL 15.19 documentation, and it's literally all about changing a trigger's definition. no cap, it's shorter than it looks π
πΈ 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 π¦
ALTER_TRIGGER changes properties of an existing trigger. that's the whole vibe.
The RENAME clause changes the name of the given trigger without otherwise changing the trigger definition. and bestie, if the table that the trigger is on is a partitioned table, then corresponding clone triggers in the partitions are renamed too. the way that detail matters π
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, extension goes bye-bye, trigger goes bye-bye with it π
You must own the table on which the trigger acts to be allowed to change its properties. no ownership, no trigger glow-up, periodt.
π PARAMETERS π
nameβ the name of an existing trigger to alter.table_nameβ the name of the table on which this trigger acts.new_nameβ the new name for the 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.
π 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. iykyk β wrong command for that job, bestie. π«Ά
π₯ 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. not standard SQL, it's giving PostgreSQL main character energy. β¨
π SEE ALSO π
ALTER TABLE (ALTER_TABLE(7))
that's the whole page, bestie β source/version/date: PostgreSQL 15.19, 2026. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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