DROP_POLICY(7pg15)
πΈ NAME πΈ
DROP POLICY β remove a row-level security policy from a table. Yep bestie, this is the DROP POLICY(7) page, and we're making policy-dropping feel like clearing out a group chat you no longer need. π
β¨ SYNOPSIS β¨
DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]
That's the whole vibe. Now let's break it down, because the details are giving main character energy. π
π DESCRIPTION π
DROP POLICY removes the specified policy from the table. Literally its whole job. β¨
Big note though: if the last policy is removed for a table and the table still has row-level security enabled via ALTER TABLE, then the default-deny policy will be used. So yeah, the table doesn't just become a free-for-all β default-deny steps in. No cap. π₯
And if you wanna disable row-level security for a table, ALTER TABLE ... DISABLE ROW LEVEL SECURITY can be used. That works whether policies for the table exist or not. Iconic. π
π PARAMETERS π
IF EXISTSβ do not throw an error if the policy does not exist. A notice is issued in this case. So it's like "bestie, it's already gone, we're fine" instead of screaming. πnameβ the name of the policy to drop.table_nameβ the name (optionally schema-qualified) of the table that the policy is on.CASCADEβ this key word does not have any effect, since there are no dependencies on policies. It's just out here with no job. πRESTRICTβ same situation: this key word does not have any effect, since there are no dependencies on policies. It's giving decorative. π
π EXAMPLES π
To drop the policy called p1 on the table named my_table:
DROP POLICY p1 ON my_table;
Slay. Clean, simple, done. β¨
π¦ COMPATIBILITY π¦
DROP POLICY is a PostgreSQL extension. So it's a PostgreSQL thing, not some standard-SQL situation. Iykyk. π«Ά
π SEE ALSO π
CREATE POLICY(CREATE_POLICY(7))ALTER POLICY(ALTER_POLICY(7))
Bestie reminder: if the last policy gets removed and the table still has row-level security enabled via ALTER TABLE, the default-deny policy will be used. Keep that vibe check in mind. π
β xoxo, your PostgreSQL 15.19 bestie, dated 2026, signing off from the DROP POLICY(7) page π
π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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