{"Entry":{"collection":"sql","key":"alter-policy","name":"ALTER POLICY","aliases":["alterpolicy"],"metadata":{"aliases":["alterpolicy"],"changed_in":["14"],"changes":[{"from":"9.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"9.5"},{"from":"9.6","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"10"},{"from":"13","purpose_changed":true,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["[ TO { role_name | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]"],"removed":[]},"to":"14"}],"content_hash":"19dcaf29f4937d30e2d3fabb6e2360a04f926719b432740dcae06d659f3c7ef4","derived_content_hash":"5045125cda79f5795cdb9932e0d933c48a0ca30d196b455ad9b089ce91fb8106","editorial":{},"first_version":"9.5","group":"role","imported_at":"2026-09-30T17:43:38.154247+08:00","last_version":"20","name":"ALTER POLICY","object":"POLICY","position":5010,"present_in":["9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"change the definition of a row-level security policy","purpose_zh":"","related":["create-policy","drop-policy"],"repair_provenance":{"original_source_revision":"a709ab85","receipt_sha256":"f8cb7a36889b90c22afcfd0233af9069d7f7e3e57fad5e758e77a199f1ac6344","repair":"wiki-repair-20261023"},"slug":"alter-policy","source_rev":"wiki-repair-20261023:8da0b246a88df46443426adf24d23b85a91ee414dda362547ba2bec1b1fcec83","synopsis":"ALTER POLICY name ON table_name RENAME TO new_name\n\nALTER POLICY name ON table_name\n[ TO { role_name | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n[ USING ( using_expression ) ]\n[ WITH CHECK ( check_expression ) ]","verb":"ALTER"}},"Definition":{"Collection":"sql","Key":"alter-policy","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"alter-policy","SourceRevision":"wiki-repair-20261023:8da0b246a88df46443426adf24d23b85a91ee414dda362547ba2bec1b1fcec83","Facts":{"anchor":"SQL-ALTERPOLICY","description_zh":"更改一条行级安全策略的定义","description_zh_html":"\u003cpre\u003eALTER POLICY name ON table_name RENAME TO new_name\n\nALTER POLICY name ON table_name\n[ TO { role_name | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n[ USING ( using_expression ) ]\n[ WITH CHECK ( check_expression ) ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e 更改一条现有行级安全策略的定义。请注意，\u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e 只允许修改策略适用的角色集合，以及 \u003ccode class=\"literal\"\u003eUSING\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003eWITH CHECK\u003c/code\u003e 表达式。若要更改策略的其他属性，例如它所适用的命令，或者它是宽松策略还是限制性策略，则必须删除该策略并重新创建。\n  \u003c/p\u003e\u003cp\u003e\n   要使用 \u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e，你必须拥有该策略所适用的表。\n  \u003c/p\u003e\u003cp\u003e\n   在 \u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e 的第二种形式中，角色列表、\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e 和\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e 在被指定时会分别独立替换。省略这些子句中的任意一个时，策略中对应的部分保持不变。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-ALTER_POLICY-VARLISTENTRY-1\"\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 id=\"ZH18-AUTO-ALTER_POLICY-VARLISTENTRY-2\"\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 id=\"ZH18-AUTO-ALTER_POLICY-VARLISTENTRY-3\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_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 id=\"ZH18-AUTO-ALTER_POLICY-VARLISTENTRY-4\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      该策略适用的角色。可以一次指定多个角色。要将该策略应用于所有角色，可使用 \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_POLICY-VARLISTENTRY-5\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      该策略的 \u003ccode class=\"literal\"\u003eUSING\u003c/code\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。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_POLICY-VARLISTENTRY-6\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      该策略的 \u003ccode class=\"literal\"\u003eWITH CHECK\u003c/code\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。\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=\"command\"\u003eALTER 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-droppolicy.html\" title=\"DROP POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP POLICY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-alterpolicy.html","lang":"en","name":"ALTER POLICY","purpose":"change the definition of a row-level security policy","purpose_zh":"更改一条行级安全策略的定义","related":["create-policy","drop-policy"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e changes the definition of an existing row-level security policy. Note that \u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e only allows the set of roles to which the policy applies and the \u003ccode class=\"literal\"\u003eUSING\u003c/code\u003e and \u003ccode class=\"literal\"\u003eWITH CHECK\u003c/code\u003e expressions to be modified. To change other properties of a policy, such as the command to which it applies or whether it is permissive or restrictive, the policy must be dropped and recreated.\u003c/p\u003e\u003cp\u003eTo use \u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e, you must own the table that the policy applies to.\u003c/p\u003e\u003cp\u003eIn the second form of \u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e, the role list, \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e, and \u003cem class=\"replaceable\"\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e are replaced independently if specified. When one of those clauses is omitted, the corresponding part of the policy is unchanged.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\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 an existing policy to alter.\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\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the policy.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe role(s) to which the policy applies. Multiple roles can be specified at one time. To apply the policy to all roles, use \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe \u003ccode class=\"literal\"\u003eUSING\u003c/code\u003e expression for the policy. See \u003ca href=\"/docs/18/sql-createpolicy.html\" title=\"CREATE POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e for details.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe \u003ccode class=\"literal\"\u003eWITH CHECK\u003c/code\u003e expression for the policy. See \u003ca href=\"/docs/18/sql-createpolicy.html\" title=\"CREATE POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e for details.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER 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/drop-policy/?v=18\" title=\"DROP POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP POLICY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"ALTER POLICY \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 RENAME TO \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\n\nALTER POLICY \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\n    [ TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n    [ USING ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e ) ]\n    [ WITH CHECK ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e ) ]","synopsis_text":"ALTER POLICY name ON table_name RENAME TO new_name\n\nALTER POLICY name ON table_name\n[ TO { role_name | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n[ USING ( using_expression ) ]\n[ WITH CHECK ( check_expression ) ]","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-alterpolicy.html","sha256":"06fd184aaf74760acfd51666d4a1496fcf55995a9fe5ca1043ea66cac44bfd0e"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"alter-policy","SourceDatabase":"center","Version":"18","Locale":"en","Title":"ALTER POLICY","Summary":"change the definition of a row-level security policy","BodyHTML":"\u003cpre\u003eALTER POLICY name ON table_name RENAME TO new_name\n\nALTER POLICY name ON table_name\n[ TO { role_name | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n[ USING ( using_expression ) ]\n[ WITH CHECK ( check_expression ) ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eALTER POLICY\u003c/code\u003e changes the definition of an existing row-level security policy. Note that \u003ccode\u003eALTER POLICY\u003c/code\u003e only allows the set of roles to which the policy applies and the \u003ccode\u003eUSING\u003c/code\u003e and \u003ccode\u003eWITH CHECK\u003c/code\u003e expressions to be modified. To change other properties of a policy, such as the command to which it applies or whether it is permissive or restrictive, the policy must be dropped and recreated.\u003c/p\u003e\u003cp\u003eTo use \u003ccode\u003eALTER POLICY\u003c/code\u003e, you must own the table that the policy applies to.\u003c/p\u003e\u003cp\u003eIn the second form of \u003ccode\u003eALTER POLICY\u003c/code\u003e, the role list, \u003cem\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e, and \u003cem\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e are replaced independently if specified. When one of those clauses is omitted, the corresponding part of the policy is unchanged.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\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 an existing policy to alter.\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\u003cem\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the policy.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe role(s) to which the policy applies. Multiple roles can be specified at one time. To apply the policy to all roles, use \u003ccode\u003ePUBLIC\u003c/code\u003e.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe \u003ccode\u003eUSING\u003c/code\u003e expression for the policy. See \u003ca href=\"/docs/18/sql-createpolicy.html\" title=\"CREATE POLICY\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e for details.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe \u003ccode\u003eWITH CHECK\u003c/code\u003e expression for the policy. See \u003ca href=\"/docs/18/sql-createpolicy.html\" title=\"CREATE POLICY\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e for details.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eALTER 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/drop-policy/?v=18\" title=\"DROP POLICY\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP POLICY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:8da0b246a88df46443426adf24d23b85a91ee414dda362547ba2bec1b1fcec83","ContentHash":"1e1bdf0a6dd745dc94fe906df9dbea93fe6d9f614d3ee594fa51c99205e0439b","Payload":{"related":["create-policy","drop-policy"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e changes the definition of an existing row-level security policy. Note that \u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e only allows the set of roles to which the policy applies and the \u003ccode class=\"literal\"\u003eUSING\u003c/code\u003e and \u003ccode class=\"literal\"\u003eWITH CHECK\u003c/code\u003e expressions to be modified. To change other properties of a policy, such as the command to which it applies or whether it is permissive or restrictive, the policy must be dropped and recreated.\u003c/p\u003e\u003cp\u003eTo use \u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e, you must own the table that the policy applies to.\u003c/p\u003e\u003cp\u003eIn the second form of \u003ccode class=\"command\"\u003eALTER POLICY\u003c/code\u003e, the role list, \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e, and \u003cem class=\"replaceable\"\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e are replaced independently if specified. When one of those clauses is omitted, the corresponding part of the policy is unchanged.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\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 an existing policy to alter.\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\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the policy.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe role(s) to which the policy applies. Multiple roles can be specified at one time. To apply the policy to all roles, use \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe \u003ccode class=\"literal\"\u003eUSING\u003c/code\u003e expression for the policy. See \u003ca href=\"/docs/18/sql-createpolicy.html\" title=\"CREATE POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e for details.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe \u003ccode class=\"literal\"\u003eWITH CHECK\u003c/code\u003e expression for the policy. See \u003ca href=\"/docs/18/sql-createpolicy.html\" title=\"CREATE POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE POLICY\u003c/span\u003e\u003c/a\u003e for details.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER 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/drop-policy/?v=18\" title=\"DROP POLICY\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP POLICY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"ALTER POLICY \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 RENAME TO \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\n\nALTER POLICY \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\n    [ TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n    [ USING ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusing_expression\u003c/code\u003e\u003c/em\u003e ) ]\n    [ WITH CHECK ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003echeck_expression\u003c/code\u003e\u003c/em\u003e ) ]","synopsis_text":"ALTER POLICY name ON table_name RENAME TO new_name\n\nALTER POLICY name ON table_name\n[ TO { role_name | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n[ USING ( using_expression ) ]\n[ WITH CHECK ( check_expression ) ]"}},"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}
