DROP_TRIGGER(7pg13)

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

πŸ‘‘ NAME πŸ‘‘

okay so DROP_TRIGGER β€” remove a trigger. That's literally the whole point, bestie. This is the DROP_TRIGGER(7pg13) page from the PostgreSQL 13.23 Documentation, and it's giving β€œdelete an existing trigger definition” energy πŸ’….

✨ SYNOPSIS ✨

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

That's the shape of it. Copy it exactly, iykyk 🫢.

πŸ¦‹ 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. Yes, ownership check β€” main character energy only for the table owner πŸ‘‘.

πŸ’– PARAMETERS πŸ’–

  • IF EXISTS β€” Do not throw an error if the trigger does not exist. A notice is issued in this case. So no dramatic error moment, just a lil notice πŸ’€.
  • name β€” The name of the trigger to remove. Bye-bye, trigger πŸŽ€.
  • table_name β€” The name (optionally schema-qualified) of the table for which the trigger is defined. Schema-qualified is allowed, bestie ✨.
  • CASCADE β€” Automatically drop objects that depend on the trigger, and in turn all objects that depend on those objects (see Section 5.14). This is the full domino-effect vibe 🌈.
  • RESTRICT β€” Refuse to drop the trigger if any objects depend on it. This is the default. Safety first, no cap 🫢.

🌈 EXAMPLES 🌈

Destroy the trigger if_dist_exists on the table films:

DROP TRIGGER if_dist_exists ON films;

That's it. Poof. Iconic πŸ’…βœ¨.

⭐ COMPATIBILITY ⭐

Real talk: 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. Different rules, different vibe 😭.

πŸŽ€ SEE ALSO πŸŽ€

CREATE TRIGGER (CREATE_TRIGGER(7)) β€” go read that one too, bestie πŸ’–.


Source/version/date check: this is PostgreSQL 13.23, dated 2025, and you just read the DROP TRIGGER(7) page. Bye bestie, slay your triggers responsibly βœ¨πŸ’…πŸ«Ά

πŸ“¦ where this page comes from