DROP_TRIGGER(7pg14)

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

πŸ’… DROP TRIGGER πŸ’…

okay so this is the DROP TRIGGER page straight out of the PostgreSQL 14.24 Documentation, and bestie, it's genuinely so straightforward you're gonna eat this up. it lives in manual section 7 (that's the SQL commands girlies), and it's all about yeeting a trigger into the void. let's get into it 🫢


✨ NAME ✨

DROP_TRIGGER β€” remove a trigger. that's it, that's the whole vibe. deleting a trigger definition. bye-bye. πŸ‘‹


✨ SYNOPSIS ✨

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

look at her. iconic. the square brackets are optional bits, and the | means "pick one of these, not both" β€” you know the drill πŸ’…


✨ DESCRIPTION ✨

DROP TRIGGER removes an existing trigger definition. literally just deletes it from existence, no cap.

⚠️ important vibe check: to run this command, the current user must be the owner of the table for which the trigger is defined. not your friend, not your coworker β€” you. so if it errors out at you, that's probably why 😭

🌸 PARAMETERS 🌸

  • IF EXISTS β€” do not throw an error if the trigger does not exist. instead a notice is issued in this case. (so like, it's chill about it, but it will mention it πŸ™ˆ)
  • name β€” the name of the trigger to remove. the actual thing you're yeeting.
  • table_name β€” the name (optionally schema-qualified) of the table for which the trigger is defined. yes, schema-qualified is allowed, slay.
  • CASCADE β€” automatically drop objects that depend on the trigger, and in turn all objects that depend on those objects (see Section 5.14). it's giving chain reaction πŸ”₯
  • RESTRICT β€” refuse to drop the trigger if any objects depend on it. this is the default, bestie. so the safe option is already loaded for you ✨

πŸŽ€ EXAMPLES πŸŽ€

destroy the trigger if_dist_exists on the table films:

DROP TRIGGER if_dist_exists ON films;

one line. that's it. go off πŸ‘‘


πŸ’€ COMPATIBILITY πŸ’€

okay here's the tea: 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

no ON table_name needed over there. so if you're porting stuff around, keep that in mind, iykyk 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

  • CREATE TRIGGER (CREATE_TRIGGER(7)) β€” you know, the other half of this relationship πŸ’œ

and that's the whole page!! cute little sign-off time: this was PostgreSQL 14.24, dated 2026 πŸŽ€ go forth and drop those triggers responsibly, bestie πŸ’–βœ¨

πŸ“¦ where this page comes from