ALTER_POLICY(7pg13)

πŸ“¦ version 13.23, in opensuse-leap 16.0

πŸ¦‹ 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, use PUBLIC.
  • using_expression β€” the USING expression for the policy. See CREATE POLICY (CREATE_POLICY(7)) for details.
  • check_expression β€” the WITH CHECK expression for the policy. See CREATE POLICY (CREATE_POLICY(7)) for details.

πŸ’œ COMPATIBILITY πŸ’œ

ALTER POLICY is a PostgreSQL extension. Iconic, honestly. πŸ’…

🌈 SEE ALSO 🌈


πŸ’– 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