{"Entry":{"collection":"sql","key":"drop-policy","name":"DROP POLICY","aliases":["droppolicy"],"metadata":{"aliases":["droppolicy"],"changed_in":["9.6"],"changes":[{"from":"9.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"9.5"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]"],"removed":[]},"to":"9.6"},{"from":"13","purpose_changed":true,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"14"}],"content_hash":"ef90fb3df101b566c4893f481fbf5af83356c5474f3ea5228eaf9375d8eefe9b","derived_content_hash":"7a6c225e2806932f8b313b77117f4116a48a76f1fe2376cd1b525e64351f7634","editorial":{},"first_version":"9.5","group":"role","imported_at":"2026-09-30T17:43:38.161225+08:00","last_version":"20","name":"DROP POLICY","object":"POLICY","position":5011,"present_in":["9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"remove a row-level security policy from a table","purpose_zh":"","related":["create-policy","alter-policy"],"repair_provenance":{"original_source_revision":"a709ab85","receipt_sha256":"1df7bf8d5acf8fc53f0097377c5a87c3a4ff274598cf585f906d79ac5d1055a0","repair":"wiki-repair-20261023"},"slug":"drop-policy","source_rev":"wiki-repair-20261023:57de8c4e936be75151e941c52de9d459b59eeae9a8ecdcf927232bea3c7312cb","synopsis":"DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]","verb":"DROP"}},"Definition":{"Collection":"sql","Key":"drop-policy","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"drop-policy","SourceRevision":"wiki-repair-20261023:57de8c4e936be75151e941c52de9d459b59eeae9a8ecdcf927232bea3c7312cb","Facts":{"anchor":"SQL-DROPPOLICY","description_zh":"从一个表中移除一条行级安全策略","description_zh_html":"\u003cpre\u003eDROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP POLICY\u003c/code\u003e 从表中移除指定的策略。注意，如果移除了某表的最后一条策略，并且该表仍通过 \u003ccode class=\"command\"\u003eALTER TABLE\u003c/code\u003e 启用了行级安全，那么将采用默认拒绝策略。无论该表是否存在策略，都可以使用\n   \u003ccode class=\"literal\"\u003eALTER TABLE ... DISABLE ROW LEVEL SECURITY\u003c/code\u003e\n   来禁用该表的行级安全。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      如果该策略不存在，则不要抛出错误。这种情况下会发出一个提示。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      要删除的策略名称。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      该策略所在表的名称（可选模式限定）。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      由于策略上不存在依赖关系，这些关键字不起任何作用。\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   要删除表 \u003ccode class=\"literal\"\u003emy_table\u003c/code\u003e 上名为 \u003ccode class=\"literal\"\u003ep1\u003c/code\u003e 的策略：\n\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nDROP POLICY p1 ON my_table;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP POLICY\u003c/code\u003e 是 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 扩展。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-createpolicy.html\" title=\"CREATE POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterpolicy.html\" title=\"ALTER POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER POLICY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-droppolicy.html","lang":"en","name":"DROP POLICY","purpose":"remove a row-level security policy from a table","purpose_zh":"从一个表中移除一条行级安全策略","related":["create-policy","alter-policy"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP POLICY\u003c/code\u003e 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 \u003ccode class=\"command\"\u003eALTER TABLE\u003c/code\u003e, then the default-deny policy will be used. \u003ccode class=\"literal\"\u003eALTER TABLE ... DISABLE ROW LEVEL SECURITY\u003c/code\u003e can be used to disable row-level security for a table, whether policies for the table exist or not.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the policy does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the policy to drop.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the table that the policy is on.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThese key words do not have any effect, since there are no dependencies on policies.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eTo drop the policy called \u003ccode class=\"literal\"\u003ep1\u003c/code\u003e on the table named \u003ccode class=\"literal\"\u003emy_table\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP POLICY p1 ON my_table;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP POLICY\u003c/code\u003e is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-policy/?v=18\" title=\"CREATE POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-policy/?v=18\" title=\"ALTER POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER POLICY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"DROP POLICY [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e ON \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e [ CASCADE | RESTRICT ]","synopsis_text":"DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-droppolicy.html","sha256":"deaa593f342ea690d99b362997aab50b6a9eba4c6341c38916074e6a9f55899b"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"drop-policy","SourceDatabase":"center","Version":"18","Locale":"en","Title":"DROP POLICY","Summary":"remove a row-level security policy from a table","BodyHTML":"\u003cpre\u003eDROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP POLICY\u003c/code\u003e 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 \u003ccode\u003eALTER TABLE\u003c/code\u003e, then the default-deny policy will be used. \u003ccode\u003eALTER TABLE ... DISABLE ROW LEVEL SECURITY\u003c/code\u003e can be used to disable row-level security for a table, whether policies for the table exist or not.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the policy does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the policy to drop.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the table that the policy is on.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eCASCADE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThese key words do not have any effect, since there are no dependencies on policies.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003eTo drop the policy called \u003ccode\u003ep1\u003c/code\u003e on the table named \u003ccode\u003emy_table\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eDROP POLICY p1 ON my_table;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP POLICY\u003c/code\u003e is a \u003cspan\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/create-policy/?v=18\" title=\"CREATE POLICY\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-policy/?v=18\" title=\"ALTER POLICY\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER POLICY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:57de8c4e936be75151e941c52de9d459b59eeae9a8ecdcf927232bea3c7312cb","ContentHash":"2ac8243d91b8658bdac4ff4412b11db9b899ecc2b767a1b60533f60685ddbcab","Payload":{"related":["create-policy","alter-policy"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP POLICY\u003c/code\u003e 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 \u003ccode class=\"command\"\u003eALTER TABLE\u003c/code\u003e, then the default-deny policy will be used. \u003ccode class=\"literal\"\u003eALTER TABLE ... DISABLE ROW LEVEL SECURITY\u003c/code\u003e can be used to disable row-level security for a table, whether policies for the table exist or not.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the policy does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the policy to drop.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the table that the policy is on.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThese key words do not have any effect, since there are no dependencies on policies.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eTo drop the policy called \u003ccode class=\"literal\"\u003ep1\u003c/code\u003e on the table named \u003ccode class=\"literal\"\u003emy_table\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP POLICY p1 ON my_table;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP POLICY\u003c/code\u003e is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-policy/?v=18\" title=\"CREATE POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-policy/?v=18\" title=\"ALTER POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER POLICY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"DROP POLICY [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e ON \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e [ CASCADE | RESTRICT ]","synopsis_text":"DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]"}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
