DROP POLICY
remove a row-level security policy from a table
English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- anchor
- SQL-DROPPOLICY
- file
- sql-droppolicy.html
- lang
- en
- name
- DROP POLICY
- purpose
- remove a row-level security policy from a table
- purpose zh
- 从一个表中移除一条行级安全策略
- sections same as
- Unknown
- slug
- 18
- synopsis html
- DROP POLICY [ IF EXISTS ] <em class="replaceable"><code>name</code></em> ON <em class="replaceable"><code>table_name</code></em> [ CASCADE | RESTRICT ]
- synopsis text
- DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]
Syntax
DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]Syntax diagrams
Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.
Definition PG 18
DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]
Description
DROP POLICY removes the specified policy from the table. Note that 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. 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.
Parameters
IF EXISTSDo not throw an error if the policy does not exist. A notice is issued in this case.
nameThe name of the policy to drop.
table_nameThe name (optionally schema-qualified) of the table that the policy is on.
CASCADERESTRICTThese key words do not have any effect, since there are no dependencies on policies.
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
CREATE POLICY, ALTER POLICYCompare versions
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:57de8c4e936be75151e941c52de9d459b59eeae9a8ecdcf927232bea3c7312cb
Text language: en · wiki-repair-20261023:57de8c4e936be75151e941c52de9d459b59eeae9a8ecdcf927232bea3c7312cb