DROP_TRIGGER(7pg17)
π 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
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms