DROP_POLICY(7pg14)

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

πŸ‘‘ DROP POLICY πŸ’…

okay bestie, so this is the DROP POLICY(7) page from the PostgreSQL 14.24 Documentation β€” yes, the big one, the icon itself β€” and we're gonna get you fluent in deleting row-level security policies like it's nothing. no cap. πŸŽ€


✨ SYNOPSIS ✨

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

like, that's the whole vibe check right there. IF EXISTS is optional, CASCADE/RESTRICT are optional, everything else is load-bearing. πŸ™ˆ


πŸ¦‹ DESCRIPTION πŸ¦‹

DROP POLICY removes the specified policy from the table. boom, gone, she's not coming to the group chat anymore. ✨

⚠️ okay this is the important part, bestie, listen up: if you remove the last policy for a table and that table still has row-level security enabled via ALTER TABLE, then the default-deny policy kicks in. so literally nobody gets through. not you, not your bestie, not the app. nobody. πŸ’€

and if you do want to turn it off? ALTER TABLE ... DISABLE ROW LEVEL SECURITY can be used to disable row-level security for a table, whether policies for the table exist or not. slay, you always have an out. 🫢


🌸 PARAMETERS 🌸

  • IF EXISTS β€” do not throw an error if the policy does not exist. instead a notice is issued in this case, so you get a lil "hey, it wasn't there!" instead of a full-on crash. very demure, very mindful. πŸ’œ
  • name β€” the name of the policy to drop. yep. that's the one you're yeeting. πŸ”₯
  • table_name β€” the name (optionally schema-qualified) of the table that the policy is on. so like my_schema.my_table is valid, iykyk. ⭐
  • CASCADE, RESTRICT β€” these key words do not have any effect, since there are no dependencies on policies. they're literally just there. decorative. main character energy with zero lines. πŸ’…

πŸŽ€ EXAMPLES πŸŽ€

to drop the policy called p1 on the table named my_table, you do:

DROP POLICY p1 ON my_table;

that's it. one line. ate and left no crumbs. πŸ“


🌈 COMPATIBILITY 🌈

DROP POLICY is a PostgreSQL extension β€” meaning she's special, she's our girl, other databases don't have her. periodt. πŸ‘‘


🧚 SEE ALSO 🧚

  • CREATE POLICY (CREATE_POLICY(7)) β€” make the policy in the first place πŸ’–
  • ALTER POLICY (ALTER_POLICY(7)) β€” tweak it when you change your mind ✨

and that's the whole page, bestie!! πŸ¦‹ ngl you're now officially a row-level security girlie. this has been PostgreSQL 14.24, dated 2026 πŸ’–πŸŽ€πŸ’…

πŸ“¦ where this page comes from