ALTER_TRIGGER(7pg13)

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

πŸ’– NAME πŸ’–

okay bestie, welcome to ALTER_TRIGGER(7pg13) β€” aka the ALTER TRIGGER page. It's literally about changing the definition of a trigger, and yes, we're gonna get into it. no cap. ✨

✨ 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. The RENAME clause changes the name of the given trigger without otherwise changing the trigger definition. 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. πŸ’€

You must own the table on which the trigger acts to be allowed to change its properties. periodt. πŸ‘‘

πŸŽ€ PARAMETERS πŸŽ€

  • name β€” the name of an existing trigger you're altering. πŸ’…
  • 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 🌸

quick heads-up bestie: the ability to temporarily enable or disable a trigger is provided by ALTER TABLE (ALTER_TABLE(7)), 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. 😭

πŸ”₯ 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. slay, but make it PostgreSQL. ✨

πŸ‘‘ SEE ALSO πŸ‘‘

  • ALTER TABLE (ALTER_TABLE(7)) β€” yes, that's the one you want for the enable/disable shenanigans. 🫢

okay that's the whole page β€” PostgreSQL 13.23, dated 2025, and the footer says ALTER TRIGGER(7). bye bestie, go alter some triggers πŸ’…βœ¨

πŸ“¦ where this page comes from