DROP_TRIGGER(7pg17)

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

πŸ’… DROP TRIGGER (7pg17) πŸ’…

okay bestie, so this is the DROP TRIGGER page from the PostgreSQL 17.11 docs β€” and yeah, the manual name is literally right there in the title, we keep it cute like that πŸŽ€


✨ NAME ✨

DROP_TRIGGER β€” remove a trigger (yes, deletion era, we're removing it πŸ’€)


🌸 SYNOPSIS 🌸

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

look at that syntax, it ate πŸ”₯


πŸ¦‹ DESCRIPTION πŸ¦‹

DROP TRIGGER removes an existing trigger definition. like, the trigger? gone. no more. bye πŸ‘‹

but listen β€” there's a whole permissions vibe check here: to actually run this command, the current user must be the owner of the table for which the trigger is defined. not the owner of the trigger, the owner of the table. iykyk 🫢


πŸ’– PARAMETERS πŸ’–

  • IF EXISTS β€” do not throw an error if the trigger does not exist. super chill about it. instead, a notice is issued in this case. like it just gently goes "hey babe, there was nothing there" πŸ™ˆ
  • name β€” the name of the trigger to remove. that's the main character of this whole operation πŸ‘‘
  • table_name β€” the name (optionally schema-qualified) of the table for which the trigger is defined. yes, you can schema-qualify it, we love options ✨
  • CASCADE β€” automatically drop objects that depend on the trigger, and in turn all objects that depend on those objects (see Section 5.15). it's giving domino effect, everything falls πŸ“
  • RESTRICT β€” refuse to drop the trigger if any objects depend on it. this is the default. lowkey the cautious one of the two, and honestly? valid 🧚

⭐ EXAMPLES ⭐

destroy the trigger if_dist_exists on the table films:

DROP TRIGGER if_dist_exists ON films;

that's it. that's the whole example. periodt πŸ’…


🌈 COMPATIBILITY 🌈

okay so 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, nothing. PostgreSQL said "we're doing it our way" and honestly, iconic behavior πŸ‘‘


πŸŽ€ SEE ALSO πŸŽ€

  • CREATE TRIGGER (CREATE_TRIGGER(7)) β€” the origin story, the prequel, go read it bestie 🫢

ngl bestie, if you're about to CASCADE something, maybe double-check what depends on it first. just saying πŸ’€

and that's a wrap, babe ✨ this page is from the PostgreSQL 17.11 documentation, dated 2026, and the manual section is DROP TRIGGER (7) β€” love that for us πŸ’œπŸŒΈπŸ¦‹

πŸ“¦ where this page comes from