ALTER_POLICY(7pg13)
π¦ NAME π¦
ALTER_POLICY β change the definition of a row level security policy.
Okay bestie, welcome to the ALTER_POLICY(7pg13) page from the PostgreSQL 13.23 Documentation. Itβs giving βrow-level security policy glow-upβ and Iβm obsessed. π
β¨ SYNOPSIS β¨
ALTER POLICY name ON table_name RENAME TO new_name
ALTER POLICY name ON table_name
[ TO { role_name | PUBLIC | CURRENT_USER | SESSION_USER } [, ...] ]
[ USING ( using_expression ) ]
[ WITH CHECK ( check_expression ) ]
πΈ DESCRIPTION πΈ
ALTER POLICY changes the definition of an existing row-level security policy. Heads up, bestie: ALTER POLICY only lets you modify the set of roles to which the policy applies and the USING and WITH CHECK expressions. 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. No shortcuts there, fr fr. π
To use ALTER POLICY, you must own the table that the policy applies to. Thatβs the vibe check, and you gotta pass it. π
In the second form of ALTER POLICY, the role list, using_expression, and check_expression are replaced independently if specified. When one of those clauses is omitted, the corresponding part of the policy is unchanged. Slay, selective editing. β¨
π PARAMETERS π
nameβ the name of an existing policy to alter.table_nameβ the name (optionally schema-qualified) of the table that the policy is on.new_nameβ the new name for the policy.role_nameβ the role(s) to which the policy applies. Multiple roles can be specified at one time. To apply the policy to all roles, usePUBLIC.using_expressionβ theUSINGexpression for the policy. SeeCREATE POLICY(CREATE_POLICY(7)) for details.check_expressionβ theWITH CHECKexpression for the policy. SeeCREATE POLICY(CREATE_POLICY(7)) for details.
π COMPATIBILITY π
ALTER POLICY is a PostgreSQL extension. Iconic, honestly. π
π SEE ALSO π
CREATE POLICY(CREATE_POLICY(7))DROP POLICY(DROP_POLICY(7))
π And thatβs the whole ALTER_POLICY page, bestie β brought to you by PostgreSQL 13.23, dated 2025, and filed under ALTER POLICY(7). Mwah! π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-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