1REVOKE(7)                PostgreSQL 13.4 Documentation               REVOKE(7)
2
3
4

NAME

6       REVOKE - remove access privileges
7

SYNOPSIS

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 role_specification [, ...]
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 role_specification [, ...]
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 role_specification [, ...]
30           [ CASCADE | RESTRICT ]
31
32       REVOKE [ GRANT OPTION FOR ]
33           { { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }
34           ON DATABASE database_name [, ...]
35           FROM role_specification [, ...]
36           [ CASCADE | RESTRICT ]
37
38       REVOKE [ GRANT OPTION FOR ]
39           { USAGE | ALL [ PRIVILEGES ] }
40           ON DOMAIN domain_name [, ...]
41           FROM role_specification [, ...]
42           [ CASCADE | RESTRICT ]
43
44       REVOKE [ GRANT OPTION FOR ]
45           { USAGE | ALL [ PRIVILEGES ] }
46           ON FOREIGN DATA WRAPPER fdw_name [, ...]
47           FROM role_specification [, ...]
48           [ CASCADE | RESTRICT ]
49
50       REVOKE [ GRANT OPTION FOR ]
51           { USAGE | ALL [ PRIVILEGES ] }
52           ON FOREIGN SERVER server_name [, ...]
53           FROM role_specification [, ...]
54           [ CASCADE | RESTRICT ]
55
56       REVOKE [ GRANT OPTION FOR ]
57           { EXECUTE | ALL [ PRIVILEGES ] }
58           ON { { FUNCTION | PROCEDURE | ROUTINE } function_name [ ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) ] [, ...]
59                | ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA schema_name [, ...] }
60           FROM role_specification [, ...]
61           [ CASCADE | RESTRICT ]
62
63       REVOKE [ GRANT OPTION FOR ]
64           { USAGE | ALL [ PRIVILEGES ] }
65           ON LANGUAGE lang_name [, ...]
66           FROM role_specification [, ...]
67           [ CASCADE | RESTRICT ]
68
69       REVOKE [ GRANT OPTION FOR ]
70           { { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }
71           ON LARGE OBJECT loid [, ...]
72           FROM role_specification [, ...]
73           [ CASCADE | RESTRICT ]
74
75       REVOKE [ GRANT OPTION FOR ]
76           { { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }
77           ON SCHEMA schema_name [, ...]
78           FROM role_specification [, ...]
79           [ CASCADE | RESTRICT ]
80
81       REVOKE [ GRANT OPTION FOR ]
82           { CREATE | ALL [ PRIVILEGES ] }
83           ON TABLESPACE tablespace_name [, ...]
84           FROM role_specification [, ...]
85           [ CASCADE | RESTRICT ]
86
87       REVOKE [ GRANT OPTION FOR ]
88           { USAGE | ALL [ PRIVILEGES ] }
89           ON TYPE type_name [, ...]
90           FROM role_specification [, ...]
91           [ CASCADE | RESTRICT ]
92
93       REVOKE [ ADMIN OPTION FOR ]
94           role_name [, ...] FROM role_specification [, ...]
95           [ GRANTED BY role_specification ]
96           [ CASCADE | RESTRICT ]
97
98       where role_specification can be:
99
100           [ GROUP ] role_name
101         | PUBLIC
102         | CURRENT_USER
103         | SESSION_USER
104

DESCRIPTION

106       The REVOKE command revokes previously granted privileges from one or
107       more roles. The key word PUBLIC refers to the implicitly defined group
108       of all roles.
109
110       See the description of the GRANT(7) command for the meaning of the
111       privilege types.
112
113       Note that any particular role will have the sum of privileges granted
114       directly to it, privileges granted to any role it is presently a member
115       of, and privileges granted to PUBLIC. Thus, for example, revoking
116       SELECT privilege from PUBLIC does not necessarily mean that all roles
117       have lost SELECT privilege on the object: those who have it granted
118       directly or via another role will still have it. Similarly, revoking
119       SELECT from a user might not prevent that user from using SELECT if
120       PUBLIC or another membership role still has SELECT rights.
121
122       If GRANT OPTION FOR is specified, only the grant option for the
123       privilege is revoked, not the privilege itself. Otherwise, both the
124       privilege and the grant option are revoked.
125
126       If a user holds a privilege with grant option and has granted it to
127       other users then the privileges held by those other users are called
128       dependent privileges. If the privilege or the grant option held by the
129       first user is being revoked and dependent privileges exist, those
130       dependent privileges are also revoked if CASCADE is specified; if it is
131       not, the revoke action will fail. This recursive revocation only
132       affects privileges that were granted through a chain of users that is
133       traceable to the user that is the subject of this REVOKE command. Thus,
134       the affected users might effectively keep the privilege if it was also
135       granted through other users.
136
137       When revoking privileges on a table, the corresponding column
138       privileges (if any) are automatically revoked on each column of the
139       table, as well. On the other hand, if a role has been granted
140       privileges on a table, then revoking the same privileges from
141       individual columns will have no effect.
142
143       When revoking membership in a role, GRANT OPTION is instead called
144       ADMIN OPTION, but the behavior is similar. This form of the command
145       also allows a GRANTED BY option, but that option is currently ignored
146       (except for checking the existence of the named role). Note also that
147       this form of the command does not allow the noise word GROUP in
148       role_specification.
149

NOTES

151       A user can only revoke privileges that were granted directly by that
152       user. If, for example, user A has granted a privilege with grant option
153       to user B, and user B has in turn granted it to user C, then user A
154       cannot revoke the privilege directly from C. Instead, user A could
155       revoke the grant option from user B and use the CASCADE option so that
156       the privilege is in turn revoked from user C. For another example, if
157       both A and B have granted the same privilege to C, A can revoke their
158       own grant but not B's grant, so C will still effectively have the
159       privilege.
160
161       When a non-owner of an object attempts to REVOKE privileges on the
162       object, the command will fail outright if the user has no privileges
163       whatsoever on the object. As long as some privilege is available, the
164       command will proceed, but it will revoke only those privileges for
165       which the user has grant options. The REVOKE ALL PRIVILEGES forms will
166       issue a warning message if no grant options are held, while the other
167       forms will issue a warning if grant options for any of the privileges
168       specifically named in the command are not held. (In principle these
169       statements apply to the object owner as well, but since the owner is
170       always treated as holding all grant options, the cases can never
171       occur.)
172
173       If a superuser chooses to issue a GRANT or REVOKE command, the command
174       is performed as though it were issued by the owner of the affected
175       object. Since all privileges ultimately come from the object owner
176       (possibly indirectly via chains of grant options), it is possible for a
177       superuser to revoke all privileges, but this might require use of
178       CASCADE as stated above.
179
180       REVOKE can also be done by a role that is not the owner of the affected
181       object, but is a member of the role that owns the object, or is a
182       member of a role that holds privileges WITH GRANT OPTION on the object.
183       In this case the command is performed as though it were issued by the
184       containing role that actually owns the object or holds the privileges
185       WITH GRANT OPTION. For example, if table t1 is owned by role g1, of
186       which role u1 is a member, then u1 can revoke privileges on t1 that are
187       recorded as being granted by g1. This would include grants made by u1
188       as well as by other members of role g1.
189
190       If the role executing REVOKE holds privileges indirectly via more than
191       one role membership path, it is unspecified which containing role will
192       be used to perform the command. In such cases it is best practice to
193       use SET ROLE to become the specific role you want to do the REVOKE as.
194       Failure to do so might lead to revoking privileges other than the ones
195       you intended, or not revoking anything at all.
196
197       See Section 5.7 for more information about specific privilege types, as
198       well as how to inspect objects' privileges.
199

EXAMPLES

201       Revoke insert privilege for the public on table films:
202
203           REVOKE INSERT ON films FROM PUBLIC;
204
205       Revoke all privileges from user manuel on view kinds:
206
207           REVOKE ALL PRIVILEGES ON kinds FROM manuel;
208
209       Note that this actually means “revoke all privileges that I granted”.
210
211       Revoke membership in role admins from user joe:
212
213           REVOKE admins FROM joe;
214

COMPATIBILITY

216       The compatibility notes of the GRANT(7) command apply analogously to
217       REVOKE. The keyword RESTRICT or CASCADE is required according to the
218       standard, but PostgreSQL assumes RESTRICT by default.
219

SEE ALSO

221       GRANT(7), ALTER DEFAULT PRIVILEGES (ALTER_DEFAULT_PRIVILEGES(7))
222
223
224
225PostgreSQL 13.4                      2021                            REVOKE(7)
Impressum