---
title: "ALTER POLICY"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/dcl_alter_policy/"
---

# ALTER POLICY

Use the ALTER POLICY statement to change the definition of a row level security policy.

## Synopsis

Use the `ALTER POLICY` statement to change the definition of a row level security policy. It can be used to change the roles that the policy applies to and the `USING` and `CHECK` expressions of the policy.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
alter_policy ::= ALTER POLICY name ON table_name 
                 [ TO { role_name
                        | PUBLIC
                        | CURRENT_USER
                        | SESSION_USER } [ , ... ] ]  
                 [ USING ( using_expression ) ] 
                 [ WITH CHECK ( check_expression ) ]

alter_policy_rename ::= ALTER POLICY name ON table_name RENAME TO 
                        new_name
```

#### alter\_policy

ALTERPOLICY[name](/stable/api/ysql/syntax_resources/grammar_diagrams#name)ON[table\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#table-name)TO,[role\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#role-name)PUBLICCURRENT\_USERSESSION\_USERUSING([using\_expression](/stable/api/ysql/syntax_resources/grammar_diagrams#using-expression))WITHCHECK([check\_expression](/stable/api/ysql/syntax_resources/grammar_diagrams#check-expression))

#### alter\_policy\_rename

ALTERPOLICY[name](/stable/api/ysql/syntax_resources/grammar_diagrams#name)ON[table\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#table-name)RENAMETO[new\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#new-name)

Where

- `name` is the name of the policy being updated.
- `table_name` is the name of the table on which the policy applies.
- `new_name` is the new name of the policy.
- `role_name` is the role(s) to which the policy applies. Use `PUBLIC` if the policy should be applied to all roles.
- `using_expression` is a SQL conditional expression. Only rows for which the condition returns to true will be visible in a `SELECT` and available for modification in an `UPDATE` or `DELETE`.
- `check_expression` is a SQL conditional expression that is used only for `INSERT` and `UPDATE` queries. Only rows for which the expression evaluates to true will be allowed in an `INSERT` or `UPDATE`. Note that unlike `using_expression`, this is evaluated against the proposed new contents of the row.

## Examples

- Rename a policy.

```plpgsql
yugabyte=# ALTER POLICY p1 ON table_foo RENAME TO p2;
```

- Apply policy to all roles.

```plpgsql
yugabyte=# ALTER POLICY p1 ON table_foo TO PUBLIC;
```

## See also

- [CREATE POLICY](/stable/api/ysql/the-sql-language/statements/dcl_create_policy "CREATE POLICY")
- [DROP POLICY](/stable/api/ysql/the-sql-language/statements/dcl_drop_policy "DROP POLICY")
- [ALTER TABLE](/stable/api/ysql/the-sql-language/statements/ddl_alter_table "ALTER TABLE")
