DROP_POLICY(7pg17)

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

πŸ’… DROP POLICY πŸ’…

okay so this is the DROP POLICY(7) page from the PostgreSQL 17.11 docs, and it's literally the β€œbye bye, row-level security policy” page. Pull up a chair, bestie 🫢


🌸 NAME 🌸

DROP_POLICY β€” remove a row-level security policy from a table.

✨ SYNOPSIS ✨

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

πŸ¦‹ DESCRIPTION πŸ¦‹

DROP POLICY removes the specified policy from the table. Periodt.

Important vibe check: 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 will be used. No cap β€” default-deny is the main character then. 😭

If you want to turn row-level security off for a table, ALTER TABLE ... DISABLE ROW LEVEL SECURITY can be used β€” whether policies for the table exist or not. Slay.

πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the policy does not exist. A notice is issued in this case, so you get a lil heads-up instead of a whole crash-out.
  • name β€” the name of the policy to drop.
  • table_name β€” the name (optionally schema-qualified) of the table that the policy is on.
  • CASCADE, RESTRICT β€” these key words do not have any effect, since there are no dependencies on policies. They're just there, being iconic and doing absolutely nothing. πŸ’…

πŸ“ EXAMPLES πŸ“

To drop the policy called p1 on the table named my_table:

DROP POLICY p1 ON my_table;

🌈 COMPATIBILITY 🌈

DROP POLICY is a PostgreSQL extension.

πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’– this page is from PostgreSQL 17.11, dated 2026, and it's the DROP POLICY(7) manual page. bye bestie, go drop those policies responsibly 🫢✨

πŸ“¦ where this page comes from