DROP_TRIGGER(7pg16)
π 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 π₯
CREATE TRIGGER(CREATE_TRIGGER(7))
mwah π this page is from PostgreSQL 16.15 docs, dated 2026 β catch you in the next manpage, bestie π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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