DROP_RULE(7pg16)
π 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 forCASCADE. π§
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
- 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