DROP_RULE(7pg18)

๐Ÿ“ฆ version 18.6, in opensuse-leap 16.0

๐Ÿ’… DROP_RULE โ€” bestie edition

ok so like, hi. you're here for DROP_RULE(7) from the PostgreSQL 18.6 docs, and honestly? you came to the right place. this is the page about yeeting a rewrite rule into the void. let's get into it ๐ŸŽ€


โœจ NAME โœจ

DROP_RULE โ€” remove a rewrite rule

like. it drops a rewrite rule. that's the whole vibe. it's giving "delete but make it SQL" ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

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

look at that. so clean. so demure. so mindful ๐Ÿฆ‹


๐Ÿ’– DESCRIPTION ๐Ÿ’–

DROP RULE drops a rewrite rule.

that's it. that's the sentence. the original docs really said "no thoughts, head empty, just vibes" and honestly? respect. it drops the rule, periodt. ๐Ÿ‘‘


โœจ PARAMETERS โœจ

  • IF EXISTS โ€” do not throw an error if the rule doesn't exist. so if you're out here trying to drop a rule that's already gone, this flag is your emotional support bestie ๐Ÿซถ. a notice gets issued in this case, so you'll still know what went down.
  • name โ€” the name of the rule to drop. you know. the one you want gone. the one that's been living rent-free in your schema. ๐Ÿ’€
  • table_name โ€” the name (optionally schema-qualified) of the table or view that the rule applies to. yes bestie, views count too. don't forget it. ๐ŸŒˆ
  • CASCADE โ€” automatically drop objects that depend on the rule, and in turn all objects that depend on those objects (see Section 5.15). it's giving domino effect, it's giving chain reaction, it's giving "you pulled one thread and the whole sweater is gone" ๐Ÿงต๐Ÿ’€. use with intention, not on a whim.
  • RESTRICT โ€” refuse to drop the rule if any objects depend on it. this is the default. she's cautious. she's protective. she said "not on my watch" ๐Ÿ›ก๏ธโœจ

๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

to drop the rewrite rule newrule:

DROP RULE newrule ON mytable;

one line. no cap. ate and left no crumbs ๐Ÿ’…๐Ÿ“


๐Ÿ’œ COMPATIBILITY ๐Ÿ’œ

DROP RULE is a PostgreSQL language extension, as is the entire query rewrite system. so if you go looking for it in standard SQL, bestie... it's not there. it's a Postgres original. main character energy only ๐Ÿ‘‘โœจ


๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

go read those too, iykyk. they're the prequel and the glow-up arc of this whole saga ๐ŸŒธ


ngl, the whole "drop the thing that drops the thing" pipeline is lowkey iconic and also highkey a little scary. CASCADE does not play. be safe out there. ๐Ÿ˜ญ๐Ÿ’–

mwah ๐Ÿ’‹ that's the page, bestie. this was PostgreSQL 18.6, dated 2026, and the man page you just read is literally titled DROP RULE(7). go forth and drop responsibly ๐ŸŽ€โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from