]> begriffs open source - ai-pg/blob - full-docs/src/sgml/man7/ALTER_POLICY.7
PG 18 docs from https://ftp.postgresql.org/pub/source/v18.0/postgresql-18.0-docs...
[ai-pg] / full-docs / src / sgml / man7 / ALTER_POLICY.7
1 '\" t
2 .\"     Title: ALTER POLICY
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "ALTER POLICY" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 ALTER_POLICY \- change the definition of a row\-level security policy
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 ALTER POLICY \fIname\fR ON \fItable_name\fR RENAME TO \fInew_name\fR
36
37 ALTER POLICY \fIname\fR ON \fItable_name\fR
38     [ TO { \fIrole_name\fR | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, \&.\&.\&.] ]
39     [ USING ( \fIusing_expression\fR ) ]
40     [ WITH CHECK ( \fIcheck_expression\fR ) ]
41 .fi
42 .SH "DESCRIPTION"
43 .PP
44 \fBALTER POLICY\fR
45 changes the definition of an existing row\-level security policy\&. Note that
46 \fBALTER POLICY\fR
47 only allows the set of roles to which the policy applies and the
48 USING
49 and
50 WITH CHECK
51 expressions to be modified\&. 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\&.
52 .PP
53 To use
54 \fBALTER POLICY\fR, you must own the table that the policy applies to\&.
55 .PP
56 In the second form of
57 \fBALTER POLICY\fR, the role list,
58 \fIusing_expression\fR, and
59 \fIcheck_expression\fR
60 are replaced independently if specified\&. When one of those clauses is omitted, the corresponding part of the policy is unchanged\&.
61 .SH "PARAMETERS"
62 .PP
63 \fIname\fR
64 .RS 4
65 The name of an existing policy to alter\&.
66 .RE
67 .PP
68 \fItable_name\fR
69 .RS 4
70 The name (optionally schema\-qualified) of the table that the policy is on\&.
71 .RE
72 .PP
73 \fInew_name\fR
74 .RS 4
75 The new name for the policy\&.
76 .RE
77 .PP
78 \fIrole_name\fR
79 .RS 4
80 The role(s) to which the policy applies\&. Multiple roles can be specified at one time\&. To apply the policy to all roles, use
81 PUBLIC\&.
82 .RE
83 .PP
84 \fIusing_expression\fR
85 .RS 4
86 The
87 USING
88 expression for the policy\&. See
89 CREATE POLICY (\fBCREATE_POLICY\fR(7))
90 for details\&.
91 .RE
92 .PP
93 \fIcheck_expression\fR
94 .RS 4
95 The
96 WITH CHECK
97 expression for the policy\&. See
98 CREATE POLICY (\fBCREATE_POLICY\fR(7))
99 for details\&.
100 .RE
101 .SH "COMPATIBILITY"
102 .PP
103 \fBALTER POLICY\fR
104 is a
105 PostgreSQL
106 extension\&.
107 .SH "SEE ALSO"
108 CREATE POLICY (\fBCREATE_POLICY\fR(7)), DROP POLICY (\fBDROP_POLICY\fR(7))