DROP_TRIGGER(7pg16)

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

πŸ’… DROP TRIGGER (7pg16) β€” remove a trigger πŸ’…

okay so bestie, this is the DROP_TRIGGER manual page from the PostgreSQL 16.15 docs, and it's literally about removing an existing trigger definition. Trigger cleanup era πŸ’–βœ¨


✨ NAME ✨

DROP_TRIGGER β€” remove a trigger πŸŽ€


🌸 SYNOPSIS 🌸

DROP TRIGGER [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]

πŸ’– DESCRIPTION πŸ’–

DROP TRIGGER removes an existing trigger definition. To execute this command, the current user must be the owner of the table for which the trigger is defined.

Like, no cap: you can't just waltz in and drop someone else's trigger. You gotta own the table, periodt. πŸ‘‘


πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the trigger does not exist. A notice is issued in this case. So it's giving "no drama if it's already gone" 🫢
  • name β€” the name of the trigger to remove. This is the trigger you're yeeting πŸ’…
  • table_name β€” the name (optionally schema-qualified) of the table for which the trigger is defined. Yes, you can schema-qualify it, iykyk πŸ¦‹
  • CASCADE β€” automatically drop objects that depend on the trigger, and in turn all objects that depend on those objects (see Section 5.14). This one cascades down the dependency chain, so be aware πŸ”₯
  • RESTRICT β€” refuse to drop the trigger if any objects depend on it. This is the default. Very "nope, not unless you're sure" energy πŸ™ˆ

πŸ¦‹ EXAMPLES πŸ¦‹

Destroy the trigger if_dist_exists on the table films:

DROP TRIGGER if_dist_exists ON films;

Iconic. Clean. Trigger gone. πŸ’€βœ¨


🌈 COMPATIBILITY 🌈

The DROP TRIGGER statement in PostgreSQL is incompatible with the SQL standard. In the SQL standard, trigger names are not local to tables, so the command is simply DROP TRIGGER name.

So yeah, not me learning that trigger names aren't local to tables in the standard β€” PostgreSQL does its own thing here, and we respect the difference 🧚


πŸ”₯ SEE ALSO πŸ”₯


mwah πŸ’‹ this page is from PostgreSQL 16.15 docs, dated 2026 β€” catch you in the next manpage, bestie 🫢

πŸ“¦ where this page comes from