DROP_RULE(7pg14)

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

πŸ’… DROP_RULE β€” bestie, let's delete a rewrite rule ✨

okay so real talk, this is the PostgreSQL 14 manual page for DROP RULE, and it's honestly one of the more chill commands out there β€” it does exactly one thing and it does it slayfully. πŸŽ€


🌸 SYNOPSIS 🌸

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

that's the whole vibe. no cap. look at it. gorgeous. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

DROP RULE drops a rewrite rule. that's it. that's the entire description. lowkey iconic of it to be so concise, honestly. πŸ’…


πŸ’– PARAMETERS πŸ’–

  • IF EXISTS β€” bestie, do not throw an error if the rule doesn't exist. instead it just issues a notice and moves on with its life. very "no thoughts, head empty" of it, and we respect that. πŸ™ˆ
  • name β€” the name of the rule you're dropping. yes, you have to know it. no, it won't guess. πŸŽ€
  • table_name β€” the name of the table or view that the rule applies to. it can be schema-qualified if you're being fancy about it (the "optionally" is doing a lot of work there). ✨
  • CASCADE β€” automatically drops objects that depend on the rule, and in turn all objects that depend on those objects (check Section 5.14 if you want the full lore). this is the "and everyone they brought to the party" option. 😭
  • RESTRICT β€” refuses to drop the rule if any objects depend on it. this is the default, so if you're not specifying anything, congrats, you already picked RESTRICT. 🫢

🌈 EXAMPLES 🌈

say you wanna drop the rewrite rule newrule β€” here's the moment:

DROP RULE newrule ON mytable;

she ate. periodt. πŸ”₯


⭐ COMPATIBILITY ⭐

DROP RULE is a PostgreSQL language extension β€” and honestly so is the entire query rewrite system, so like… the whole family is built different. iykyk. πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘

go make rules, go change rules, go delete rules β€” full circle, bestie. πŸ¦‹


ok so that's the whole page!! PostgreSQL 14.24, dated 2026, and the page is DROP RULE(7) in case you forgot where you were. mwah, go drop some rules responsibly πŸ’‹βœ¨πŸŽ€
πŸ“¦ where this page comes from