2 doc/src/sgml/ref/alter_policy.sgml
3 PostgreSQL documentation
6 <refentry id="SQL-ALTERPOLICY">
7 <indexterm zone="sql-alterpolicy">
8 <primary>ALTER POLICY</primary>
12 <refentrytitle>ALTER POLICY</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements</refmiscinfo>
18 <refname>ALTER POLICY</refname>
19 <refpurpose>change the definition of a row level security policy</refpurpose>
24 ALTER POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> RENAME TO <replaceable class="PARAMETER">new_name</replaceable>
26 ALTER POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable>
27 [ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC | CURRENT_USER | SESSION_USER } [, ...] ]
28 [ USING ( <replaceable class="parameter">using_expression</replaceable> ) ]
29 [ WITH CHECK ( <replaceable class="parameter">check_expression</replaceable> ) ]
34 <title>Description</title>
37 <command>ALTER POLICY</command> changes the definition of an existing
38 row-level security policy. Note that <command>ALTER POLICY</command>
39 only allows the set of roles to which the policy applies and the
40 <literal>USING</literal> and <literal>WITH CHECK</literal> expressions to
41 be modified. To change other properties of a policy, such as the command
42 to which it applies or whether it is permissive or restrictive, the policy
43 must be dropped and recreated.
47 To use <command>ALTER POLICY</command>, you must own the table that
48 the policy applies to.
52 In the second form of <command>ALTER POLICY</command>, the role list,
53 <replaceable class="parameter">using_expression</replaceable>, and
54 <replaceable class="parameter">check_expression</replaceable> are replaced
55 independently if specified. When one of those clauses is omitted, the
56 corresponding part of the policy is unchanged.
61 <title>Parameters</title>
65 <term><replaceable class="parameter">name</replaceable></term>
68 The name of an existing policy to alter.
74 <term><replaceable class="parameter">table_name</replaceable></term>
77 The name (optionally schema-qualified) of the table that the
84 <term><replaceable class="parameter">new_name</replaceable></term>
87 The new name for the policy.
93 <term><replaceable class="parameter">role_name</replaceable></term>
96 The role(s) to which the policy applies. Multiple roles can be
97 specified at one time. To apply the policy to all roles,
98 use <literal>PUBLIC</literal>.
104 <term><replaceable class="parameter">using_expression</replaceable></term>
107 The <literal>USING</literal> expression for the policy.
108 See <xref linkend="sql-createpolicy"> for details.
114 <term><replaceable class="parameter">check_expression</replaceable></term>
117 The <literal>WITH CHECK</literal> expression for the policy.
118 See <xref linkend="sql-createpolicy"> for details.
127 <title>Compatibility</title>
130 <command>ALTER POLICY</command> is a <productname>PostgreSQL</productname> extension.
135 <title>See Also</title>
137 <simplelist type="inline">
138 <member><xref linkend="sql-createpolicy"></member>
139 <member><xref linkend="sql-droppolicy"></member>