DROP_EVENT_TRIGGER(7pg13)

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

πŸ’… DROP EVENT TRIGGER πŸ’…

ok so this is the DROP EVENT TRIGGER page from the PostgreSQL 13.23 docs, and it's honestly kind of a short one but it's still iconic, so let's get into it bestie 🫢


✨ NAME ✨

DROP_EVENT_TRIGGER β€” yeet an event trigger out of existence, remove it, delete it, it's gone girl πŸ’€


🌸 SYNOPSIS 🌸

DROP EVENT TRIGGER [ IF EXISTS ] name [ CASCADE | RESTRICT ]

look at that syntax, so clean, so simple, main character energy fr fr ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

DROP EVENT TRIGGER removes an existing event trigger. that's the whole vibe. one job, does it well πŸ’…

ok but here's the important bit β€” to actually run this command, the current user must be the owner of the event trigger. so like, you can't just roll up and start dropping other people's triggers, that's not the move, the database said no πŸ™ˆ


πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the event trigger doesn't exist. instead a notice is issued in this case. so like, no dramatic meltdown if the thing is already gone, just a lil heads up πŸ’Œ
  • name β€” the name of the event trigger you're removing. yes, that's it, that's the parameter, you literally just say which one 🎯
  • 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 domino effect, it's giving chain reaction, it's giving be careful bestie πŸ”₯ 😭
  • RESTRICT β€” refuse to drop the trigger if any objects depend on it. this is the default, so if you don't say anything it's already protecting you, no cap πŸ›‘οΈ

⭐ EXAMPLES ⭐

destroy the trigger snitch:

DROP EVENT TRIGGER snitch;

and the snitch is GONE. bye. not me making an example of it πŸ’€ πŸŽ€


🧚 COMPATIBILITY 🧚

there is no DROP EVENT TRIGGER statement in the SQL standard. nope. not a thing. this is a PostgreSQL original, iykyk πŸ’œ


🌈 SEE ALSO 🌈

go read those too, they're the whole trilogy and you deserve the full lore 🫢✨


lowkey reminder bestie: RESTRICT is the default, so if you want the cascade chaos you gotta ask for it πŸ’…

ok that's the whole page!! slayed, no notes πŸ’– this was PostgreSQL 13.23 documentation, dated 2025 β€” mwah, stan, periodt πŸŽ€πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from