1REVOKE(7) PostgreSQL 9.2.24 Documentation REVOKE(7)
2
3
4
6 REVOKE - remove access privileges
7
9 REVOKE [ GRANT OPTION FOR ]
10 { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }
11 [, ...] | ALL [ PRIVILEGES ] }
12 ON { [ TABLE ] table_name [, ...]
13 | ALL TABLES IN SCHEMA schema_name [, ...] }
14 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
15 [ CASCADE | RESTRICT ]
16
17 REVOKE [ GRANT OPTION FOR ]
18 { { SELECT | INSERT | UPDATE | REFERENCES } ( column_name [, ...] )
19 [, ...] | ALL [ PRIVILEGES ] ( column_name [, ...] ) }
20 ON [ TABLE ] table_name [, ...]
21 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
22 [ CASCADE | RESTRICT ]
23
24 REVOKE [ GRANT OPTION FOR ]
25 { { USAGE | SELECT | UPDATE }
26 [, ...] | ALL [ PRIVILEGES ] }
27 ON { SEQUENCE sequence_name [, ...]
28 | ALL SEQUENCES IN SCHEMA schema_name [, ...] }
29 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
30 [ CASCADE | RESTRICT ]
31
32 REVOKE [ GRANT OPTION FOR ]
33 { { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }
34 ON DATABASE database_name [, ...]
35 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
36 [ CASCADE | RESTRICT ]
37
38 REVOKE [ GRANT OPTION FOR ]
39 { USAGE | ALL [ PRIVILEGES ] }
40 ON DOMAIN domain_name [, ...]
41 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
42 [ CASCADE | RESTRICT ]
43
44 REVOKE [ GRANT OPTION FOR ]
45 { USAGE | ALL [ PRIVILEGES ] }
46 ON FOREIGN DATA WRAPPER fdw_name [, ...]
47 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
48 [ CASCADE | RESTRICT ]
49
50 REVOKE [ GRANT OPTION FOR ]
51 { USAGE | ALL [ PRIVILEGES ] }
52 ON FOREIGN SERVER server_name [, ...]
53 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
54 [ CASCADE | RESTRICT ]
55
56 REVOKE [ GRANT OPTION FOR ]
57 { EXECUTE | ALL [ PRIVILEGES ] }
58 ON { FUNCTION function_name ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) [, ...]
59 | ALL FUNCTIONS IN SCHEMA schema_name [, ...] }
60 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
61 [ CASCADE | RESTRICT ]
62
63 REVOKE [ GRANT OPTION FOR ]
64 { USAGE | ALL [ PRIVILEGES ] }
65 ON LANGUAGE lang_name [, ...]
66 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
67 [ CASCADE | RESTRICT ]
68
69 REVOKE [ GRANT OPTION FOR ]
70 { { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }
71 ON LARGE OBJECT loid [, ...]
72 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
73 [ CASCADE | RESTRICT ]
74
75 REVOKE [ GRANT OPTION FOR ]
76 { { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }
77 ON SCHEMA schema_name [, ...]
78 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
79 [ CASCADE | RESTRICT ]
80
81 REVOKE [ GRANT OPTION FOR ]
82 { CREATE | ALL [ PRIVILEGES ] }
83 ON TABLESPACE tablespace_name [, ...]
84 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
85 [ CASCADE | RESTRICT ]
86
87 REVOKE [ GRANT OPTION FOR ]
88 { USAGE | ALL [ PRIVILEGES ] }
89 ON TYPE type_name [, ...]
90 FROM { [ GROUP ] role_name | PUBLIC } [, ...]
91 [ CASCADE | RESTRICT ]
92
93 REVOKE [ ADMIN OPTION FOR ]
94 role_name [, ...] FROM role_name [, ...]
95 [ CASCADE | RESTRICT ]
96
98 The REVOKE command revokes previously granted privileges from one or
99 more roles. The key word PUBLIC refers to the implicitly defined group
100 of all roles.
101
102 See the description of the GRANT(7) command for the meaning of the
103 privilege types.
104
105 Note that any particular role will have the sum of privileges granted
106 directly to it, privileges granted to any role it is presently a member
107 of, and privileges granted to PUBLIC. Thus, for example, revoking
108 SELECT privilege from PUBLIC does not necessarily mean that all roles
109 have lost SELECT privilege on the object: those who have it granted
110 directly or via another role will still have it. Similarly, revoking
111 SELECT from a user might not prevent that user from using SELECT if
112 PUBLIC or another membership role still has SELECT rights.
113
114 If GRANT OPTION FOR is specified, only the grant option for the
115 privilege is revoked, not the privilege itself. Otherwise, both the
116 privilege and the grant option are revoked.
117
118 If a user holds a privilege with grant option and has granted it to
119 other users then the privileges held by those other users are called
120 dependent privileges. If the privilege or the grant option held by the
121 first user is being revoked and dependent privileges exist, those
122 dependent privileges are also revoked if CASCADE is specified; if it is
123 not, the revoke action will fail. This recursive revocation only
124 affects privileges that were granted through a chain of users that is
125 traceable to the user that is the subject of this REVOKE command. Thus,
126 the affected users might effectively keep the privilege if it was also
127 granted through other users.
128
129 When revoking privileges on a table, the corresponding column
130 privileges (if any) are automatically revoked on each column of the
131 table, as well. On the other hand, if a role has been granted
132 privileges on a table, then revoking the same privileges from
133 individual columns will have no effect.
134
135 When revoking membership in a role, GRANT OPTION is instead called
136 ADMIN OPTION, but the behavior is similar. Note also that this form of
137 the command does not allow the noise word GROUP.
138
140 Use psql(1)'s \dp command to display the privileges granted on existing
141 tables and columns. See GRANT(7) for information about the format. For
142 non-table objects there are other \d commands that can display their
143 privileges.
144
145 A user can only revoke privileges that were granted directly by that
146 user. If, for example, user A has granted a privilege with grant option
147 to user B, and user B has in turned granted it to user C, then user A
148 cannot revoke the privilege directly from C. Instead, user A could
149 revoke the grant option from user B and use the CASCADE option so that
150 the privilege is in turn revoked from user C. For another example, if
151 both A and B have granted the same privilege to C, A can revoke his own
152 grant but not B's grant, so C will still effectively have the
153 privilege.
154
155 When a non-owner of an object attempts to REVOKE privileges on the
156 object, the command will fail outright if the user has no privileges
157 whatsoever on the object. As long as some privilege is available, the
158 command will proceed, but it will revoke only those privileges for
159 which the user has grant options. The REVOKE ALL PRIVILEGES forms will
160 issue a warning message if no grant options are held, while the other
161 forms will issue a warning if grant options for any of the privileges
162 specifically named in the command are not held. (In principle these
163 statements apply to the object owner as well, but since the owner is
164 always treated as holding all grant options, the cases can never
165 occur.)
166
167 If a superuser chooses to issue a GRANT or REVOKE command, the command
168 is performed as though it were issued by the owner of the affected
169 object. Since all privileges ultimately come from the object owner
170 (possibly indirectly via chains of grant options), it is possible for a
171 superuser to revoke all privileges, but this might require use of
172 CASCADE as stated above.
173
174 REVOKE can also be done by a role that is not the owner of the affected
175 object, but is a member of the role that owns the object, or is a
176 member of a role that holds privileges WITH GRANT OPTION on the object.
177 In this case the command is performed as though it were issued by the
178 containing role that actually owns the object or holds the privileges
179 WITH GRANT OPTION. For example, if table t1 is owned by role g1, of
180 which role u1 is a member, then u1 can revoke privileges on t1 that are
181 recorded as being granted by g1. This would include grants made by u1
182 as well as by other members of role g1.
183
184 If the role executing REVOKE holds privileges indirectly via more than
185 one role membership path, it is unspecified which containing role will
186 be used to perform the command. In such cases it is best practice to
187 use SET ROLE to become the specific role you want to do the REVOKE as.
188 Failure to do so might lead to revoking privileges other than the ones
189 you intended, or not revoking anything at all.
190
192 Revoke insert privilege for the public on table films:
193
194 REVOKE INSERT ON films FROM PUBLIC;
195
196 Revoke all privileges from user manuel on view kinds:
197
198 REVOKE ALL PRIVILEGES ON kinds FROM manuel;
199
200 Note that this actually means “revoke all privileges that I granted”.
201
202 Revoke membership in role admins from user joe:
203
204 REVOKE admins FROM joe;
205
207 The compatibility notes of the GRANT(7) command apply analogously to
208 REVOKE. The keyword RESTRICT or CASCADE is required according to the
209 standard, but PostgreSQL assumes RESTRICT by default.
210
212 GRANT(7)
213
214
215
216PostgreSQL 9.2.24 2017-11-06 REVOKE(7)