DROP_RULE(7pg14)
π 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 π
CREATE RULE(CREATE_RULE(7))ALTER RULE(ALTER_RULE(7))
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
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-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