ALTER_TRIGGER(7pg15)

πŸ“¦ version 15.19, in opensuse-leap 16.0

πŸ’… 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, if NO is 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