3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "REVOKE" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 REVOKE \- remove access privileges
35 REVOKE [ GRANT OPTION FOR ]
36 { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }
37 [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
38 ON { [ TABLE ] \fItable_name\fR [, \&.\&.\&.]
39 | ALL TABLES IN SCHEMA \fIschema_name\fR [, \&.\&.\&.] }
40 FROM \fIrole_specification\fR [, \&.\&.\&.]
41 [ GRANTED BY \fIrole_specification\fR ]
42 [ CASCADE | RESTRICT ]
44 REVOKE [ GRANT OPTION FOR ]
45 { { SELECT | INSERT | UPDATE | REFERENCES } ( \fIcolumn_name\fR [, \&.\&.\&.] )
46 [, \&.\&.\&.] | ALL [ PRIVILEGES ] ( \fIcolumn_name\fR [, \&.\&.\&.] ) }
47 ON [ TABLE ] \fItable_name\fR [, \&.\&.\&.]
48 FROM \fIrole_specification\fR [, \&.\&.\&.]
49 [ GRANTED BY \fIrole_specification\fR ]
50 [ CASCADE | RESTRICT ]
52 REVOKE [ GRANT OPTION FOR ]
53 { { USAGE | SELECT | UPDATE }
54 [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
55 ON { SEQUENCE \fIsequence_name\fR [, \&.\&.\&.]
56 | ALL SEQUENCES IN SCHEMA \fIschema_name\fR [, \&.\&.\&.] }
57 FROM \fIrole_specification\fR [, \&.\&.\&.]
58 [ GRANTED BY \fIrole_specification\fR ]
59 [ CASCADE | RESTRICT ]
61 REVOKE [ GRANT OPTION FOR ]
62 { { CREATE | CONNECT | TEMPORARY | TEMP } [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
63 ON DATABASE \fIdatabase_name\fR [, \&.\&.\&.]
64 FROM \fIrole_specification\fR [, \&.\&.\&.]
65 [ GRANTED BY \fIrole_specification\fR ]
66 [ CASCADE | RESTRICT ]
68 REVOKE [ GRANT OPTION FOR ]
69 { USAGE | ALL [ PRIVILEGES ] }
70 ON DOMAIN \fIdomain_name\fR [, \&.\&.\&.]
71 FROM \fIrole_specification\fR [, \&.\&.\&.]
72 [ GRANTED BY \fIrole_specification\fR ]
73 [ CASCADE | RESTRICT ]
75 REVOKE [ GRANT OPTION FOR ]
76 { USAGE | ALL [ PRIVILEGES ] }
77 ON FOREIGN DATA WRAPPER \fIfdw_name\fR [, \&.\&.\&.]
78 FROM \fIrole_specification\fR [, \&.\&.\&.]
79 [ GRANTED BY \fIrole_specification\fR ]
80 [ CASCADE | RESTRICT ]
82 REVOKE [ GRANT OPTION FOR ]
83 { USAGE | ALL [ PRIVILEGES ] }
84 ON FOREIGN SERVER \fIserver_name\fR [, \&.\&.\&.]
85 FROM \fIrole_specification\fR [, \&.\&.\&.]
86 [ GRANTED BY \fIrole_specification\fR ]
87 [ CASCADE | RESTRICT ]
89 REVOKE [ GRANT OPTION FOR ]
90 { EXECUTE | ALL [ PRIVILEGES ] }
91 ON { { FUNCTION | PROCEDURE | ROUTINE } \fIfunction_name\fR [ ( [ [ \fIargmode\fR ] [ \fIarg_name\fR ] \fIarg_type\fR [, \&.\&.\&.] ] ) ] [, \&.\&.\&.]
92 | ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA \fIschema_name\fR [, \&.\&.\&.] }
93 FROM \fIrole_specification\fR [, \&.\&.\&.]
94 [ GRANTED BY \fIrole_specification\fR ]
95 [ CASCADE | RESTRICT ]
97 REVOKE [ GRANT OPTION FOR ]
98 { USAGE | ALL [ PRIVILEGES ] }
99 ON LANGUAGE \fIlang_name\fR [, \&.\&.\&.]
100 FROM \fIrole_specification\fR [, \&.\&.\&.]
101 [ GRANTED BY \fIrole_specification\fR ]
102 [ CASCADE | RESTRICT ]
104 REVOKE [ GRANT OPTION FOR ]
105 { { SELECT | UPDATE } [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
106 ON LARGE OBJECT \fIloid\fR [, \&.\&.\&.]
107 FROM \fIrole_specification\fR [, \&.\&.\&.]
108 [ GRANTED BY \fIrole_specification\fR ]
109 [ CASCADE | RESTRICT ]
111 REVOKE [ GRANT OPTION FOR ]
112 { { SET | ALTER SYSTEM } [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
113 ON PARAMETER \fIconfiguration_parameter\fR [, \&.\&.\&.]
114 FROM \fIrole_specification\fR [, \&.\&.\&.]
115 [ GRANTED BY \fIrole_specification\fR ]
116 [ CASCADE | RESTRICT ]
118 REVOKE [ GRANT OPTION FOR ]
119 { { CREATE | USAGE } [, \&.\&.\&.] | ALL [ PRIVILEGES ] }
120 ON SCHEMA \fIschema_name\fR [, \&.\&.\&.]
121 FROM \fIrole_specification\fR [, \&.\&.\&.]
122 [ GRANTED BY \fIrole_specification\fR ]
123 [ CASCADE | RESTRICT ]
125 REVOKE [ GRANT OPTION FOR ]
126 { CREATE | ALL [ PRIVILEGES ] }
127 ON TABLESPACE \fItablespace_name\fR [, \&.\&.\&.]
128 FROM \fIrole_specification\fR [, \&.\&.\&.]
129 [ GRANTED BY \fIrole_specification\fR ]
130 [ CASCADE | RESTRICT ]
132 REVOKE [ GRANT OPTION FOR ]
133 { USAGE | ALL [ PRIVILEGES ] }
134 ON TYPE \fItype_name\fR [, \&.\&.\&.]
135 FROM \fIrole_specification\fR [, \&.\&.\&.]
136 [ GRANTED BY \fIrole_specification\fR ]
137 [ CASCADE | RESTRICT ]
139 REVOKE [ { ADMIN | INHERIT | SET } OPTION FOR ]
140 \fIrole_name\fR [, \&.\&.\&.] FROM \fIrole_specification\fR [, \&.\&.\&.]
141 [ GRANTED BY \fIrole_specification\fR ]
142 [ CASCADE | RESTRICT ]
144 where \fIrole_specification\fR can be:
146 [ GROUP ] \fIrole_name\fR
156 command revokes previously granted privileges from one or more roles\&. The key word
158 refers to the implicitly defined group of all roles\&.
160 See the description of the
162 command for the meaning of the privilege types\&.
164 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
165 PUBLIC\&. Thus, for example, revoking
169 does not necessarily mean that all roles have lost
171 privilege on the object: those who have it granted directly or via another role will still have it\&. Similarly, revoking
173 from a user might not prevent that user from using
177 or another membership role still has
183 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\&.
185 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
187 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
189 command\&. Thus, the affected users might effectively keep the privilege if it was also granted through other users\&.
191 When revoking privileges on a table, the corresponding column privileges (if any) are automatically revoked on each column of the table, as well\&. On the other hand, if a role has been granted privileges on a table, then revoking the same privileges from individual columns will have no effect\&.
193 When revoking membership in a role,
196 ADMIN OPTION, but the behavior is similar\&. Note that, in releases prior to
198 16, dependent privileges were not tracked for grants of role membership, and thus
200 had no effect for role membership\&. This is no longer the case\&. Note also that this form of the command does not allow the noise word
203 \fIrole_specification\fR\&.
207 can be removed from an existing role grant, it is also possible to revoke
210 SET OPTION\&. This is equivalent to setting the value of the corresponding option to
214 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 turn 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
216 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 their own grant but not B\*(Aqs grant, so C will still effectively have the privilege\&.
218 When a non\-owner of an object attempts to
220 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
221 \fBREVOKE ALL PRIVILEGES\fR
222 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\&.)
224 If a superuser chooses to issue a
228 command, the command is performed as though it were issued by the owner of the affected object\&. (Since roles do not have owners, in the case of a
230 of role membership, the command is performed as though it were issued by the bootstrap superuser\&.) 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
235 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
237 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
238 WITH GRANT OPTION\&. For example, if table
245 can revoke privileges on
247 that are recorded as being granted by
248 g1\&. This would include grants made by
250 as well as by other members of role
253 If the role executing
255 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
257 to become the specific role you want to do the
259 as\&. Failure to do so might lead to revoking privileges other than the ones you intended, or not revoking anything at all\&.
263 for more information about specific privilege types, as well as how to inspect objects\*(Aq privileges\&.
266 Revoke insert privilege for the public on table
273 REVOKE INSERT ON films FROM PUBLIC;
279 Revoke all privileges from user
288 REVOKE ALL PRIVILEGES ON kinds FROM manuel;
294 Note that this actually means
295 \(lqrevoke all privileges that I granted\(rq\&.
297 Revoke membership in role
306 REVOKE admins FROM joe;
313 The compatibility notes of the
315 command apply analogously to
316 \fBREVOKE\fR\&. The keyword
320 is required according to the standard, but
326 \fBGRANT\fR(7), ALTER DEFAULT PRIVILEGES (\fBALTER_DEFAULT_PRIVILEGES\fR(7))