summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/man7/ALTER_POLICY.7
blob: 4570776033d63433adcda2c403c93a92ba618392 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'\" t
.\"     Title: ALTER POLICY
.\"    Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 2024
.\"    Manual: PostgreSQL 15.6 Documentation
.\"    Source: PostgreSQL 15.6
.\"  Language: English
.\"
.TH "ALTER POLICY" "7" "2024" "PostgreSQL 15.6" "PostgreSQL 15.6 Documentation"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ALTER_POLICY \- change the definition of a row\-level security policy
.SH "SYNOPSIS"
.sp
.nf
ALTER POLICY \fIname\fR ON \fItable_name\fR RENAME TO \fInew_name\fR

ALTER POLICY \fIname\fR ON \fItable_name\fR
    [ TO { \fIrole_name\fR | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, \&.\&.\&.] ]
    [ USING ( \fIusing_expression\fR ) ]
    [ WITH CHECK ( \fIcheck_expression\fR ) ]
.fi
.SH "DESCRIPTION"
.PP
\fBALTER POLICY\fR
changes the definition of an existing row\-level security policy\&. Note that
\fBALTER POLICY\fR
only allows the set of roles to which the policy applies and the
USING
and
WITH CHECK
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\&.
.PP
To use
\fBALTER POLICY\fR, you must own the table that the policy applies to\&.
.PP
In the second form of
\fBALTER POLICY\fR, the role list,
\fIusing_expression\fR, and
\fIcheck_expression\fR
are replaced independently if specified\&. When one of those clauses is omitted, the corresponding part of the policy is unchanged\&.
.SH "PARAMETERS"
.PP
\fIname\fR
.RS 4
The name of an existing policy to alter\&.
.RE
.PP
\fItable_name\fR
.RS 4
The name (optionally schema\-qualified) of the table that the policy is on\&.
.RE
.PP
\fInew_name\fR
.RS 4
The new name for the policy\&.
.RE
.PP
\fIrole_name\fR
.RS 4
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\&.
.RE
.PP
\fIusing_expression\fR
.RS 4
The
USING
expression for the policy\&. See
CREATE POLICY (\fBCREATE_POLICY\fR(7))
for details\&.
.RE
.PP
\fIcheck_expression\fR
.RS 4
The
WITH CHECK
expression for the policy\&. See
CREATE POLICY (\fBCREATE_POLICY\fR(7))
for details\&.
.RE
.SH "COMPATIBILITY"
.PP
\fBALTER POLICY\fR
is a
PostgreSQL
extension\&.
.SH "SEE ALSO"
CREATE POLICY (\fBCREATE_POLICY\fR(7)), DROP POLICY (\fBDROP_POLICY\fR(7))