]> begriffs open source - ai-pg/blob - full-docs/txt/sql-alterpolicy.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-alterpolicy.txt
1
2 ALTER POLICY
3
4    ALTER POLICY — change the definition of a row-level security policy
5
6 Synopsis
7
8 ALTER POLICY name ON table_name RENAME TO new_name
9
10 ALTER POLICY name ON table_name
11     [ TO { role_name | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [,
12 ...] ]
13     [ USING ( using_expression ) ]
14     [ WITH CHECK ( check_expression ) ]
15
16 Description
17
18    ALTER POLICY changes the definition of an existing row-level security
19    policy. Note that ALTER POLICY only allows the set of roles to which
20    the policy applies and the USING and WITH CHECK expressions to be
21    modified. To change other properties of a policy, such as the command
22    to which it applies or whether it is permissive or restrictive, the
23    policy must be dropped and recreated.
24
25    To use ALTER POLICY, you must own the table that the policy applies to.
26
27    In the second form of ALTER POLICY, the role list, using_expression,
28    and check_expression are replaced independently if specified. When one
29    of those clauses is omitted, the corresponding part of the policy is
30    unchanged.
31
32 Parameters
33
34    name
35           The name of an existing policy to alter.
36
37    table_name
38           The name (optionally schema-qualified) of the table that the
39           policy is on.
40
41    new_name
42           The new name for the policy.
43
44    role_name
45           The role(s) to which the policy applies. Multiple roles can be
46           specified at one time. To apply the policy to all roles, use
47           PUBLIC.
48
49    using_expression
50           The USING expression for the policy. See CREATE POLICY for
51           details.
52
53    check_expression
54           The WITH CHECK expression for the policy. See CREATE POLICY for
55           details.
56
57 Compatibility
58
59    ALTER POLICY is a PostgreSQL extension.
60
61 See Also
62
63    CREATE POLICY, DROP POLICY