3
.\" Author: The PostgreSQL Global Development Group
4
.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
6
.\" Manual: PostgreSQL 9.1beta1 Documentation
7
.\" Source: PostgreSQL 9.1beta1
10
.TH "REVOKE" "7" "2011-04-27" "PostgreSQL 9.1beta1" "PostgreSQL 9.1beta1 Documentation"
11
.\" -----------------------------------------------------------------
12
.\" * set default formatting
13
.\" -----------------------------------------------------------------
14
.\" disable hyphenation
16
.\" disable justification (adjust text to left margin only)
18
.\" -----------------------------------------------------------------
19
.\" * MAIN CONTENT STARTS HERE *
20
.\" -----------------------------------------------------------------
22
REVOKE \- remove access privileges
27
REVOKE [ GRANT OPTION FOR ]
28
{ { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }
29
[, \&.\&.\&.] | ALL [ PRIVILEGES ] }
30
ON { [ TABLE ] \fItable_name\fR [, \&.\&.\&.]
31
| ALL TABLES IN SCHEMA \fIschema_name\fR [, \&.\&.\&.] }
32
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
33
[ CASCADE | RESTRICT ]
35
REVOKE [ GRANT OPTION FOR ]
36
{ { SELECT | INSERT | UPDATE | REFERENCES } ( \fIcolumn\fR [, \&.\&.\&.] )
37
[, \&.\&.\&.] | ALL [ PRIVILEGES ] ( \fIcolumn\fR [, \&.\&.\&.] ) }
38
ON [ TABLE ] \fItable_name\fR [, \&.\&.\&.]
39
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
40
[ CASCADE | RESTRICT ]
42
REVOKE [ GRANT OPTION FOR ]
43
{ { USAGE | SELECT | UPDATE }
44
[, \&.\&.\&.] | ALL [ PRIVILEGES ] }
45
ON { SEQUENCE \fIsequence_name\fR [, \&.\&.\&.]
46
| ALL SEQUENCES IN SCHEMA \fIschema_name\fR [, \&.\&.\&.] }
47
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
48
[ CASCADE | RESTRICT ]
50
REVOKE [ GRANT OPTION FOR ]
51
{ { CREATE | CONNECT | TEMPORARY | TEMP } [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
52
ON DATABASE \fIdatabase_name\fR [, \&.\&.\&.]
53
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
54
[ CASCADE | RESTRICT ]
56
REVOKE [ GRANT OPTION FOR ]
57
{ USAGE | ALL [ PRIVILEGES ] }
58
ON FOREIGN DATA WRAPPER \fIfdw_name\fR [, \&.\&.\&.]
59
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
60
[ CASCADE | RESTRICT ]
62
REVOKE [ GRANT OPTION FOR ]
63
{ USAGE | ALL [ PRIVILEGES ] }
64
ON FOREIGN SERVER \fIserver_name\fR [, \&.\&.\&.]
65
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
66
[ CASCADE | RESTRICT ]
68
REVOKE [ GRANT OPTION FOR ]
69
{ EXECUTE | ALL [ PRIVILEGES ] }
70
ON { FUNCTION \fIfunction_name\fR ( [ [ \fIargmode\fR ] [ \fIarg_name\fR ] \fIarg_type\fR [, \&.\&.\&.] ] ) [, \&.\&.\&.]
71
| ALL FUNCTIONS IN SCHEMA \fIschema_name\fR [, \&.\&.\&.] }
72
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
73
[ CASCADE | RESTRICT ]
75
REVOKE [ GRANT OPTION FOR ]
76
{ USAGE | ALL [ PRIVILEGES ] }
77
ON LANGUAGE \fIlang_name\fR [, \&.\&.\&.]
78
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
79
[ CASCADE | RESTRICT ]
81
REVOKE [ GRANT OPTION FOR ]
82
{ { SELECT | UPDATE } [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
83
ON LARGE OBJECT \fIloid\fR [, \&.\&.\&.]
84
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
85
[ CASCADE | RESTRICT ]
87
REVOKE [ GRANT OPTION FOR ]
88
{ { CREATE | USAGE } [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
89
ON SCHEMA \fIschema_name\fR [, \&.\&.\&.]
90
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
91
[ CASCADE | RESTRICT ]
93
REVOKE [ GRANT OPTION FOR ]
94
{ CREATE | ALL [ PRIVILEGES ] }
95
ON TABLESPACE \fItablespace_name\fR [, \&.\&.\&.]
96
FROM { [ GROUP ] \fIrole_name\fR | PUBLIC } [, \&.\&.\&.]
97
[ CASCADE | RESTRICT ]
99
REVOKE [ ADMIN OPTION FOR ]
100
\fIrole_name\fR [, \&.\&.\&.] FROM \fIrole_name\fR [, \&.\&.\&.]
101
[ CASCADE | RESTRICT ]
107
command revokes previously granted privileges from one or more roles\&. The key word
109
refers to the implicitly defined group of all roles\&.
111
See the description of the
113
command for the meaning of the privilege types\&.
115
Note that any particular role will have the sum of privileges granted directly to it, privileges granted to any role it is presently a member of, and privileges granted to
116
PUBLIC\&. Thus, for example, revoking
120
does not necessarily mean that all roles have lost
122
privilege on the object: those who have it granted directly or via another role will still have it\&. Similarly, revoking
124
from a user might not prevent that user from using
128
or another membership role still has
134
is specified, only the grant option for the privilege is revoked, not the privilege itself\&. Otherwise, both the privilege and the grant option are revoked\&.
136
If a user holds a privilege with grant option and has granted it to other users then the privileges held by those other users are called dependent privileges\&. If the privilege or the grant option held by the first user is being revoked and dependent privileges exist, those dependent privileges are also revoked if
138
is specified; if it is not, the revoke action will fail\&. This recursive revocation only affects privileges that were granted through a chain of users that is traceable to the user that is the subject of this
140
command\&. Thus, the affected users might effectively keep the privilege if it was also granted through other users\&.
142
When revoking privileges on a table, the corresponding column privileges (if any) are automatically revoked on each column of the table, as well\&.
144
When revoking membership in a role,
147
ADMIN OPTION, but the behavior is similar\&. Note also that this form of the command does not allow the noise word
154
command to display the privileges granted on existing tables and columns\&. See
156
for information about the format\&. For non\-table objects there are other
158
commands that can display their privileges\&.
160
A user can only revoke privileges that were granted directly by that user\&. If, for example, user A has granted a privilege with grant option to user B, and user B has in turned granted it to user C, then user A cannot revoke the privilege directly from C\&. Instead, user A could revoke the grant option from user B and use the
162
option so that the privilege is in turn revoked from user C\&. For another example, if both A and B have granted the same privilege to C, A can revoke his own grant but not B\(aqs grant, so C will still effectively have the privilege\&.
164
When a non\-owner of an object attempts to
166
privileges on the object, the command will fail outright if the user has no privileges whatsoever on the object\&. As long as some privilege is available, the command will proceed, but it will revoke only those privileges for which the user has grant options\&. The
167
REVOKE ALL PRIVILEGES
168
forms will issue a warning message if no grant options are held, while the other forms will issue a warning if grant options for any of the privileges specifically named in the command are not held\&. (In principle these statements apply to the object owner as well, but since the owner is always treated as holding all grant options, the cases can never occur\&.)
170
If a superuser chooses to issue a
174
command, the command is performed as though it were issued by the owner of the affected object\&. Since all privileges ultimately come from the object owner (possibly indirectly via chains of grant options), it is possible for a superuser to revoke all privileges, but this might require use of
179
can also be done by a role that is not the owner of the affected object, but is a member of the role that owns the object, or is a member of a role that holds privileges
181
on the object\&. In this case the command is performed as though it were issued by the containing role that actually owns the object or holds the privileges
182
WITH GRANT OPTION\&. For example, if table
189
can revoke privileges on
191
that are recorded as being granted by
192
g1\&. This would include grants made by
194
as well as by other members of role
197
If the role executing
199
holds privileges indirectly via more than one role membership path, it is unspecified which containing role will be used to perform the command\&. In such cases it is best practice to use
201
to become the specific role you want to do the
203
as\&. Failure to do so might lead to revoking privileges other than the ones you intended, or not revoking anything at all\&.
206
Revoke insert privilege for the public on table
213
REVOKE INSERT ON films FROM PUBLIC;
219
Revoke all privileges from user
228
REVOKE ALL PRIVILEGES ON kinds FROM manuel;
234
Note that this actually means
235
\(lqrevoke all privileges that I granted\(rq\&.
237
Revoke membership in role
246
REVOKE admins FROM joe;
253
The compatibility notes of the
255
command apply analogously to
256
REVOKE\&. The keyword
260
is required according to the standard, but