~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/man7/REVOKE.7

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'\" t
 
2
.\"     Title: REVOKE
 
3
.\"    Author: The PostgreSQL Global Development Group
 
4
.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
 
5
.\"      Date: 2011-04-27
 
6
.\"    Manual: PostgreSQL 9.1beta1 Documentation
 
7
.\"    Source: PostgreSQL 9.1beta1
 
8
.\"  Language: English
 
9
.\"
 
10
.TH "REVOKE" "7" "2011-04-27" "PostgreSQL 9.1beta1" "PostgreSQL 9.1beta1 Documentation"
 
11
.\" -----------------------------------------------------------------
 
12
.\" * set default formatting
 
13
.\" -----------------------------------------------------------------
 
14
.\" disable hyphenation
 
15
.nh
 
16
.\" disable justification (adjust text to left margin only)
 
17
.ad l
 
18
.\" -----------------------------------------------------------------
 
19
.\" * MAIN CONTENT STARTS HERE *
 
20
.\" -----------------------------------------------------------------
 
21
.SH "NAME"
 
22
REVOKE \- remove access privileges
 
23
.\" REVOKE
 
24
.SH "SYNOPSIS"
 
25
.sp
 
26
.nf
 
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 ]
 
34
 
 
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 ]
 
41
 
 
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 ]
 
49
 
 
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 ]
 
55
 
 
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 ]
 
61
 
 
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 ]
 
67
 
 
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 ]
 
74
 
 
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 ]
 
80
 
 
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 ]
 
86
 
 
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 ]
 
92
 
 
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 ]
 
98
 
 
99
REVOKE [ ADMIN OPTION FOR ]
 
100
    \fIrole_name\fR [, \&.\&.\&.] FROM \fIrole_name\fR [, \&.\&.\&.]
 
101
    [ CASCADE | RESTRICT ]
 
102
.fi
 
103
.SH "DESCRIPTION"
 
104
.PP
 
105
The
 
106
REVOKE
 
107
command revokes previously granted privileges from one or more roles\&. The key word
 
108
PUBLIC
 
109
refers to the implicitly defined group of all roles\&.
 
110
.PP
 
111
See the description of the
 
112
\fBGRANT\fR(7)
 
113
command for the meaning of the privilege types\&.
 
114
.PP
 
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
 
117
SELECT
 
118
privilege from
 
119
PUBLIC
 
120
does not necessarily mean that all roles have lost
 
121
SELECT
 
122
privilege on the object: those who have it granted directly or via another role will still have it\&. Similarly, revoking
 
123
SELECT
 
124
from a user might not prevent that user from using
 
125
SELECT
 
126
if
 
127
PUBLIC
 
128
or another membership role still has
 
129
SELECT
 
130
rights\&.
 
131
.PP
 
132
If
 
133
GRANT OPTION FOR
 
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\&.
 
135
.PP
 
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
 
137
CASCADE
 
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
 
139
REVOKE
 
140
command\&. Thus, the affected users might effectively keep the privilege if it was also granted through other users\&.
 
141
.PP
 
142
When revoking privileges on a table, the corresponding column privileges (if any) are automatically revoked on each column of the table, as well\&.
 
143
.PP
 
144
When revoking membership in a role,
 
145
GRANT OPTION
 
146
is instead called
 
147
ADMIN OPTION, but the behavior is similar\&. Note also that this form of the command does not allow the noise word
 
148
GROUP\&.
 
149
.SH "NOTES"
 
150
.PP
 
151
Use
 
152
\fBpsql\fR(1)\(aqs
 
153
\edp
 
154
command to display the privileges granted on existing tables and columns\&. See
 
155
\fBGRANT\fR(7)
 
156
for information about the format\&. For non\-table objects there are other
 
157
\ed
 
158
commands that can display their privileges\&.
 
159
.PP
 
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
 
161
CASCADE
 
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\&.
 
163
.PP
 
164
When a non\-owner of an object attempts to
 
165
REVOKE
 
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\&.)
 
169
.PP
 
170
If a superuser chooses to issue a
 
171
GRANT
 
172
or
 
173
REVOKE
 
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
 
175
CASCADE
 
176
as stated above\&.
 
177
.PP
 
178
REVOKE
 
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
 
180
WITH GRANT OPTION
 
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
 
183
t1
 
184
is owned by role
 
185
g1, of which role
 
186
u1
 
187
is a member, then
 
188
u1
 
189
can revoke privileges on
 
190
t1
 
191
that are recorded as being granted by
 
192
g1\&. This would include grants made by
 
193
u1
 
194
as well as by other members of role
 
195
g1\&.
 
196
.PP
 
197
If the role executing
 
198
REVOKE
 
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
 
200
SET ROLE
 
201
to become the specific role you want to do the
 
202
REVOKE
 
203
as\&. Failure to do so might lead to revoking privileges other than the ones you intended, or not revoking anything at all\&.
 
204
.SH "EXAMPLES"
 
205
.PP
 
206
Revoke insert privilege for the public on table
 
207
films:
 
208
.sp
 
209
.if n \{\
 
210
.RS 4
 
211
.\}
 
212
.nf
 
213
REVOKE INSERT ON films FROM PUBLIC;
 
214
.fi
 
215
.if n \{\
 
216
.RE
 
217
.\}
 
218
.PP
 
219
Revoke all privileges from user
 
220
manuel
 
221
on view
 
222
kinds:
 
223
.sp
 
224
.if n \{\
 
225
.RS 4
 
226
.\}
 
227
.nf
 
228
REVOKE ALL PRIVILEGES ON kinds FROM manuel;
 
229
.fi
 
230
.if n \{\
 
231
.RE
 
232
.\}
 
233
.sp
 
234
Note that this actually means
 
235
\(lqrevoke all privileges that I granted\(rq\&.
 
236
.PP
 
237
Revoke membership in role
 
238
admins
 
239
from user
 
240
joe:
 
241
.sp
 
242
.if n \{\
 
243
.RS 4
 
244
.\}
 
245
.nf
 
246
REVOKE admins FROM joe;
 
247
.fi
 
248
.if n \{\
 
249
.RE
 
250
.\}
 
251
.SH "COMPATIBILITY"
 
252
.PP
 
253
The compatibility notes of the
 
254
\fBGRANT\fR(7)
 
255
command apply analogously to
 
256
REVOKE\&. The keyword
 
257
RESTRICT
 
258
or
 
259
CASCADE
 
260
is required according to the standard, but
 
261
PostgreSQL
 
262
assumes
 
263
RESTRICT
 
264
by default\&.
 
265
.SH "SEE ALSO"
 
266
.sp
 
267
\fBGRANT\fR(7)