DROP_RULE(7pg16)

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

πŸ’… DROP_RULE πŸ’…

okay bestie, so this is the DROP RULE page from the PostgreSQL 16 docs (the 7pg16 one, iykyk) β€” and honestly? it's a short one, and we're gonna slay it together. literally the whole vibe is "there's a rewrite rule, and we're getting rid of it." that's it. that's the page. πŸŽ€


✨ SYNOPSIS ✨

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

look at her. so clean. so iconic. πŸ¦‹


🌸 DESCRIPTION 🌸

DROP RULE drops a rewrite rule. yes bestie, that's genuinely the entire description β€” the manpage is not beating the "short and sweet" allegations today. πŸ’€ but like, that IS the tea: you point at a rewrite rule, and it's gone. simple as that. ✨


🫢 PARAMETERS 🫢

  • IF EXISTS β€” do not throw an error if the rule doesn't exist. instead, a notice gets issued. so it's like, "bestie, that rule was never here, but pop off anyway." 🌈 a little heads-up instead of a whole dramatic meltdown. πŸ’…
  • name β€” the name of the rule to drop. the actual victim. the main character we're saying goodbye to. 😭
  • table_name β€” the name of the table or view that the rule applies to. it can optionally be schema-qualified, so go ahead and be fancy with it. πŸ‘‘
  • CASCADE β€” automatically drop objects that depend on the rule, and then in turn all objects that depend on those objects (see Section 5.14). it's giving "consequences rippling out into the universe" β€” so yes, read Section 5.14 before you go full rizz mode on this one. πŸ”₯
  • RESTRICT β€” refuse to drop the rule if any objects depend on it. this is the default, so it's the "safe word" of this command β€” no chain reactions unless you explicitly ask for CASCADE. 🧚
real talk: those two are mutually exclusive vibes β€” pick one, don't be weird about it.

πŸ“ EXAMPLES πŸ“

to drop the rewrite rule newrule: πŸ¦‹

DROP RULE newrule ON mytable;

see how it just... goes. newrule on mytable, gone, reduced to atoms. ate and left no crumbs. πŸ’…


πŸ’œ COMPATIBILITY πŸ’œ

DROP RULE is a PostgreSQL language extension β€” and no cap, so is the entire query rewrite system. so if you're expecting this in some other database, bestie, it's not there. πŸ™ˆ


⭐ SEE ALSO ⭐

  • CREATE RULE (CREATE_RULE(7)) β€” for when you want a rule in the first place πŸ’–
  • ALTER RULE (ALTER_RULE(7)) β€” for when you just wanna tweak her, not delete her πŸ’«

okay that's the whole page!! πŸ’– this little gem comes to you from PostgreSQL 16.15, dated 2026 β€” go forth and drop your rules responsibly, bestie. mwah. πŸŽ€βœ¨πŸ«Ά

πŸ“¦ where this page comes from