ALTER_TRIGGER(7)
๐ ALTER_TRIGGER โ change the definition of a trigger โจ
okay bestie, so this is ALTER_TRIGGER(7) from the PostgreSQL 18.6 Documentation and it's literally the glow-up page for your triggers. no cap, it's short, it's sweet, it's giving "small but mighty." ๐
โจ SYNOPSIS โจ
ALTER TRIGGER name ON table_name RENAME TO new_name
ALTER TRIGGER name ON table_name [ NO ] DEPENDS ON EXTENSION extension_name
๐ฆ DESCRIPTION ๐ฆ
So ALTER TRIGGER changes properties of an existing trigger. that's it, that's the vibe. ๐
The RENAME clause changes the name of the given trigger without otherwise changing the trigger definition. iconic, minimal effort, maximum payoff. and heads up โ if the table that the trigger is on is a partitioned table, then corresponding clone triggers in the partitions are renamed too. yes girl, the whole friend group gets a rebrand, fr fr. ๐
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. it's a ride-or-die situation. extension goes down, trigger goes down with it. ๐ญ
gatekeeping alert: you must own the table on which the trigger acts to be allowed to change its properties. no ownership, no edits. periodt.
๐ธ PARAMETERS ๐ธ
nameโ the name of an existing trigger to alter. like, the one you're here for.table_nameโ the name of the table on which this trigger acts. its home base, its main character location. ๐new_nameโ the new name for the trigger. fresh start, new era. โจ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 pick your extensions wisely bestie, this is a committed relationship ๐
๐ 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 came here looking for the on/off switchโฆ wrong page babe ๐ ALTER TABLE is over there. not me almost sending you to the wrong function.
๐ซถ 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;
see how clean that is?? ate and left no crumbs. ๐ฅ
๐ COMPATIBILITY ๐
ALTER TRIGGER is a PostgreSQL extension of the SQL standard. so it's not standard-SQL behaviour, it's a PostgreSQL original. ๐
โญ SEE ALSO โญ
ALTER TABLE (ALTER_TABLE(7))
and that's the whole page, bestie!! ๐ง no notes, flawless, we love a short manpage. this was PostgreSQL 18.6, dated 2026, and yes the original really does say ALTER TRIGGER(7) at the bottom even though the page is literally about the underscore version. slay. ๐๐๐ฆ๐ธ๐ซถ๐
๐ฆ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 ยท PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 ยท PostgreSQL
- arch rolling: postgresql 18.6-4 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 ยท PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms