Postgresql 中文操作指南

DROP POLICY

DROP POLICY — 从表中删除行级安全策略

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 从表中删除指定策略。请注意,如果表中删除了最后一个策略,且表仍通过 ALTER TABLE 启用了行级安全,那么将使用默认拒绝策略。 ALTER TABLE …​ DISABLE ROW LEVEL SECURITY 可用于禁用表中的行级安全,无论表中是否存在策略。

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 EXISTS

    • Do not throw an error if the policy does not exist. A notice is issued in this case.

  • 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.

Examples

在下表 my_table 中下放名为 p1 的策略:

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

DROP POLICY p1 ON my_table;

Compatibility

DROP POLICY 是PostgreSQL扩展。

DROP POLICY is a PostgreSQL extension.