{"Entry":{"collection":"sql","key":"revoke","name":"REVOKE","aliases":["revoke"],"metadata":{"aliases":["revoke"],"changed_in":["6.5","7.0","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.2","9.5","10","11","14","15","16","17"],"changes":[{"from":"6.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","usage","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["FROM { PUBLIC | GROUP ER\"\u003egBLE\u003e | username }"],"removed":["FROM { PUBLIC | GROUP group | username }"]},"to":"6.5"},{"from":"6.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["FROM { PUBLIC | GROUP groupname | username }"],"removed":["FROM { PUBLIC | GROUP ER\"\u003egBLE\u003e | username }"]},"to":"7.0"},{"from":"7.0","purpose_changed":false,"renamed":{"from_file":"sql-revoke.htm","to_file":"sql-revoke.html"},"sections":{"added":[],"changed":["compatibility"],"removed":[]},"status":"changed","synopsis":null,"to":"7.1"},{"from":"7.1","purpose_changed":true,"renamed":null,"sections":{"added":["notes","examples","see_also"],"changed":["description","compatibility"],"removed":["usage"]},"status":"changed","synopsis":{"added":["REVOKE { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } [,...] | ALL [ PRIVILEGES ] }","ON [ TABLE ] object [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]"],"removed":["REVOKE privilege [, ...]","FROM { PUBLIC | GROUP groupname | username }"]},"to":"7.2"},{"from":"7.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["ON [ TABLE ] tablename [, ...]","REVOKE { { CREATE | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }","ON DATABASE dbname [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","REVOKE { EXECUTE | ALL [ PRIVILEGES ] }","ON FUNCTION funcname ([type, ...]) [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","REVOKE { USAGE | ALL [ PRIVILEGES ] }","ON LANGUAGE langname [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","REVOKE { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }","ON SCHEMA schemaname [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]"],"removed":["ON [ TABLE ] object [, ...]"]},"to":"7.3"},{"from":"7.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["REVOKE [ GRANT OPTION FOR ]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","[ CASCADE | RESTRICT ]"],"removed":[]},"to":"7.4"},{"from":"7.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes","examples"],"removed":[]},"status":"changed","synopsis":{"added":["REVOKE [ GRANT OPTION FOR ]","{ CREATE | ALL [ PRIVILEGES ] }","ON TABLESPACE tablespacename [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","[ CASCADE | RESTRICT ]"],"removed":[]},"to":"8.0"},{"from":"8.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes","examples"],"removed":[]},"status":"changed","synopsis":{"added":["ON FUNCTION funcname ( [ [ argmode ] [ argname ] argtype [, ...] ] ) [, ...]","REVOKE [ ADMIN OPTION FOR ]","role [, ...] FROM username [, ...]","[ CASCADE | RESTRICT ]"],"removed":["ON FUNCTION funcname ([type, ...]) [, ...]"]},"to":"8.1"},{"from":"8.1","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["{ { USAGE | SELECT | UPDATE }","[,...] | ALL [ PRIVILEGES ] }","ON SEQUENCE sequencename [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","{ { CREATE | CONNECT | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }"],"removed":["{ { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER }"]},"to":"8.2"},{"from":"8.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["FROM { [ GROUP ] rolename | PUBLIC } [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","role [, ...] FROM rolename [, ...]"],"removed":["FROM { username | GROUP groupname | PUBLIC } [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","FROM { username | GROUP groupname | PUBLIC } [, ...]","role [, ...] FROM username [, ...]"]},"to":"8.3"},{"from":"8.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes"],"removed":[]},"status":"changed","synopsis":{"added":["{ { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }","[,...] | ALL [ PRIVILEGES ] }","ON [ TABLE ] tablename [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","{ { SELECT | INSERT | UPDATE | REFERENCES } ( column [, ...] )","[,...] | ALL [ PRIVILEGES ] ( column [, ...] ) }","ON DATABASE dbname [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","{ USAGE | ALL [ PRIVILEGES ] }","ON FOREIGN DATA WRAPPER fdwname [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","{ USAGE | ALL [ PRIVILEGES ] }","ON FOREIGN SERVER servername [, ...]"],"removed":[]},"to":"8.4"},{"from":"8.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["ON { [ TABLE ] table_name [, ...]","| ALL TABLES IN SCHEMA schema_name [, ...] }","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON [ TABLE ] table_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON { SEQUENCE sequence_name [, ...]","| ALL SEQUENCES IN SCHEMA schema_name [, ...] }","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON DATABASE database_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON FOREIGN DATA WRAPPER fdw_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON FOREIGN SERVER server_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON { FUNCTION function_name ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) [, ...]","| ALL FUNCTIONS IN SCHEMA schema_name [, ...] }","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON LANGUAGE lang_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","{ { SELECT | UPDATE } [,...] | ALL [ PRIVILEGES ] }","ON LARGE OBJECT loid [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON SCHEMA schema_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","ON TABLESPACE tablespace_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","role_name [, ...] FROM role_name [, ...]"],"removed":["ON [ TABLE ] tablename [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON [ TABLE ] tablename [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON SEQUENCE sequencename [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON DATABASE dbname [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON FOREIGN DATA WRAPPER fdwname [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON FOREIGN SERVER servername [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON FUNCTION funcname ( [ [ argmode ] [ argname ] argtype [, ...] ] ) [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON LANGUAGE langname [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON SCHEMA schemaname [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","ON TABLESPACE tablespacename [, ...]","FROM { [ GROUP ] rolename | PUBLIC } [, ...]","role [, ...] FROM rolename [, ...]"]},"to":"9.0"},{"from":"9.1","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":{"added":["{ { SELECT | INSERT | UPDATE | REFERENCES } ( column_name [, ...] )","[, ...] | ALL [ PRIVILEGES ] ( column_name [, ...] ) }","ON DATABASE database_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","{ USAGE | ALL [ PRIVILEGES ] }","ON DOMAIN domain_name [, ...]","REVOKE [ GRANT OPTION FOR ]","{ USAGE | ALL [ PRIVILEGES ] }","ON TYPE type_name [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","[ CASCADE | RESTRICT ]","REVOKE [ ADMIN OPTION FOR ]"],"removed":["{ { SELECT | INSERT | UPDATE | REFERENCES } ( column [, ...] )","[, ...] | ALL [ PRIVILEGES ] ( column [, ...] ) }"]},"to":"9.2"},{"from":"9.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":null,"to":"9.3"},{"from":"9.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":{"added":["FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","FROM role_specification [, ...]","role_name [, ...] FROM role_specification [, ...]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","[ GROUP ] role_name","| PUBLIC","| CURRENT_USER","| SESSION_USER"],"removed":["FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","FROM { [ GROUP ] role_name | PUBLIC } [, ...]","role_name [, ...] FROM role_name [, ...]"]},"to":"9.5"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":null,"to":"9.6"},{"from":"9.6","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["examples"],"removed":[]},"status":"changed","synopsis":{"added":["ON { FUNCTION function_name [ ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) ] [, ...]"],"removed":[]},"to":"10"},{"from":"10","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["ON { { FUNCTION | PROCEDURE | ROUTINE } function_name [ ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) ] [, ...]","| ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA schema_name [, ...] }"],"removed":[]},"to":"11"},{"from":"11","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes","see_also"],"removed":[]},"status":"changed","synopsis":null,"to":"12"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["FROM role_specification [, ...]","[ GRANTED BY role_specification ]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","FROM role_specification [, ...]","[ GRANTED BY role_specification ]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","FROM role_specification [, ...]","[ GRANTED BY role_specification ]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","FROM role_specification [, ...]","[ GRANTED BY role_specification ]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","FROM role_specification [, ...]","[ GRANTED BY role_specification ]","| CURRENT_ROLE","| CURRENT_USER"],"removed":[]},"to":"14"},{"from":"14","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["{ { SET | ALTER SYSTEM } [, ...] | ALL [ PRIVILEGES ] }","ON PARAMETER configuration_parameter [, ...]","FROM role_specification [, ...]","[ GRANTED BY role_specification ]","[ CASCADE | RESTRICT ]","REVOKE [ GRANT OPTION FOR ]","{ { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }"],"removed":[]},"to":"15"},{"from":"15","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes"],"removed":[]},"status":"changed","synopsis":{"added":["REVOKE [ { ADMIN | INHERIT | SET } OPTION FOR ]"],"removed":[]},"to":"16"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":{"added":["{ { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }"],"removed":[]},"to":"17"},{"from":"18","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes"],"removed":[]},"status":"changed","synopsis":null,"to":"19"}],"content_hash":"5ed94e04148a34278f7c96bca546e5ac8c7d6f84c2a16aa1f69f670a0f3d018f","editorial":{},"first_version":"6.4","group":"role","imported_at":"2026-09-30T17:43:37.980751+08:00","last_version":"20","name":"REVOKE","object":"","position":5001,"present_in":["6.4","6.5","7.0","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"remove access privileges","purpose_zh":"","related":["grant","alter-default-privileges"],"slug":"revoke","source_rev":"a709ab85","synopsis":"REVOKE [ GRANT OPTION FOR ]\n{ { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }\n[, ...] | ALL [ PRIVILEGES ] }\nON { [ TABLE ] table_name [, ...]\n| ALL TABLES IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | INSERT | UPDATE | REFERENCES } ( column_name [, ...] )\n[, ...] | ALL [ PRIVILEGES ] ( column_name [, ...] ) }\nON [ TABLE ] table_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { USAGE | SELECT | UPDATE }\n[, ...] | ALL [ PRIVILEGES ] }\nON { SEQUENCE sequence_name [, ...]\n| ALL SEQUENCES IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }\nON DATABASE database_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON DOMAIN domain_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON FOREIGN DATA WRAPPER fdw_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON FOREIGN SERVER server_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ EXECUTE | ALL [ PRIVILEGES ] }\nON { { FUNCTION | PROCEDURE | ROUTINE } function_name [ ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) ] [, ...]\n| ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON LANGUAGE lang_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }\nON LARGE OBJECT loid [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SET | ALTER SYSTEM } [, ...] | ALL [ PRIVILEGES ] }\nON PARAMETER configuration_parameter [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }\nON SCHEMA schema_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ CREATE | ALL [ PRIVILEGES ] }\nON TABLESPACE tablespace_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON TYPE type_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ { ADMIN | INHERIT | SET } OPTION FOR ]\nrole_name [, ...] FROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nwhere role_specification can be:\n\n[ GROUP ] role_name\n| PUBLIC\n| CURRENT_ROLE\n| CURRENT_USER\n| SESSION_USER","verb":"REVOKE"}},"Definition":{"Collection":"sql","Key":"revoke","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"revoke","SourceRevision":"a709ab85","Facts":{"anchor":"SQL-REVOKE","file":"sql-revoke.html","lang":"en","name":"REVOKE","purpose":"remove access privileges","purpose_zh":"","related":["grant","alter-default-privileges"],"sections":[{"html":"\u003cp\u003eThe \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e command revokes previously granted privileges from one or more roles. The key word \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e refers to the implicitly defined group of all roles.\u003c/p\u003e\u003cp\u003eSee the description of the \u003ca href=\"/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e command for the meaning of the privilege types.\u003c/p\u003e\u003cp\u003eNote 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 \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e. Thus, for example, revoking \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e privilege from \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e does not necessarily mean that all roles have lost \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e privilege on the object: those who have it granted directly or via another role will still have it. Similarly, revoking \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e from a user might not prevent that user from using \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e if \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e or another membership role still has \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e rights.\u003c/p\u003e\u003cp\u003eIf \u003ccode class=\"literal\"\u003eGRANT OPTION FOR\u003c/code\u003e 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.\u003c/p\u003e\u003cp\u003eIf 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 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 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 \u003ccode class=\"literal\"\u003eREVOKE\u003c/code\u003e command. Thus, the affected users might effectively keep the privilege if it was also granted through other users.\u003c/p\u003e\u003cp\u003eWhen 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.\u003c/p\u003e\u003cp\u003eWhen revoking membership in a role, \u003ccode class=\"literal\"\u003eGRANT OPTION\u003c/code\u003e is instead called \u003ccode class=\"literal\"\u003eADMIN OPTION\u003c/code\u003e, but the behavior is similar. Note that, in releases prior to \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 16, dependent privileges were not tracked for grants of role membership, and thus \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 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 \u003ccode class=\"literal\"\u003eGROUP\u003c/code\u003e in \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\u003cp\u003eJust as \u003ccode class=\"literal\"\u003eADMIN OPTION\u003c/code\u003e can be removed from an existing role grant, it is also possible to revoke \u003ccode class=\"literal\"\u003eINHERIT OPTION\u003c/code\u003e or \u003ccode class=\"literal\"\u003eSET OPTION\u003c/code\u003e. This is equivalent to setting the value of the corresponding option to \u003ccode class=\"literal\"\u003eFALSE\u003c/code\u003e.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cp\u003eA 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 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 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's grant, so C will still effectively have the privilege.\u003c/p\u003e\u003cp\u003eWhen a non-owner of an object attempts to \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 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 \u003ccode class=\"command\"\u003eREVOKE ALL PRIVILEGES\u003c/code\u003e 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.)\u003c/p\u003e\u003cp\u003eIf a superuser chooses to issue a \u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e or \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 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 \u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e 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 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e as stated above.\u003c/p\u003e\u003cp\u003e\u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 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 \u003ccode class=\"literal\"\u003eWITH GRANT OPTION\u003c/code\u003e 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 \u003ccode class=\"literal\"\u003eWITH GRANT OPTION\u003c/code\u003e. For example, if table \u003ccode class=\"literal\"\u003et1\u003c/code\u003e is owned by role \u003ccode class=\"literal\"\u003eg1\u003c/code\u003e, of which role \u003ccode class=\"literal\"\u003eu1\u003c/code\u003e is a member, then \u003ccode class=\"literal\"\u003eu1\u003c/code\u003e can revoke privileges on \u003ccode class=\"literal\"\u003et1\u003c/code\u003e that are recorded as being granted by \u003ccode class=\"literal\"\u003eg1\u003c/code\u003e. This would include grants made by \u003ccode class=\"literal\"\u003eu1\u003c/code\u003e as well as by other members of role \u003ccode class=\"literal\"\u003eg1\u003c/code\u003e.\u003c/p\u003e\u003cp\u003eIf the role executing \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 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 \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e to become the specific role you want to do the \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e as. Failure to do so might lead to revoking privileges other than the ones you intended, or not revoking anything at all.\u003c/p\u003e\u003cp\u003eSee \u003ca href=\"/docs/18/ddl-priv.html\" title=\"5.8. Privileges\"\u003eSection 5.8\u003c/a\u003e for more information about specific privilege types, as well as how to inspect objects' privileges.\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003eRevoke insert privilege for the public on table \u003ccode class=\"literal\"\u003efilms\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eREVOKE INSERT ON films FROM PUBLIC;\n\u003c/pre\u003e\u003cp\u003eRevoke all privileges from user \u003ccode class=\"literal\"\u003emanuel\u003c/code\u003e on view \u003ccode class=\"literal\"\u003ekinds\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eREVOKE ALL PRIVILEGES ON kinds FROM manuel;\n\u003c/pre\u003e\u003cp\u003eNote that this actually means \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003erevoke all privileges that I granted\u003c/span\u003e”\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eRevoke membership in role \u003ccode class=\"literal\"\u003eadmins\u003c/code\u003e from user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eREVOKE admins FROM joe;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThe compatibility notes of the \u003ca href=\"/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e command apply analogously to \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e. The keyword \u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e or \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e is required according to the standard, but \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e assumes \u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e by default.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/grant/?v=18\" title=\"GRANT\"\u003e\u003cspan class=\"refentrytitle\"\u003eGRANT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-default-privileges/?v=18\" title=\"ALTER DEFAULT PRIVILEGES\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER DEFAULT PRIVILEGES\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"REVOKE [ GRANT OPTION FOR ]\n    { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }\n    [, ...] | ALL [ PRIVILEGES ] }\n    ON { [ TABLE ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e [, ...]\n         | ALL TABLES IN SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema_name\u003c/code\u003e\u003c/em\u003e [, ...] }\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { SELECT | INSERT | UPDATE | REFERENCES } ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_name\u003c/code\u003e\u003c/em\u003e [, ...] )\n    [, ...] | ALL [ PRIVILEGES ] ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_name\u003c/code\u003e\u003c/em\u003e [, ...] ) }\n    ON [ TABLE ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { USAGE | SELECT | UPDATE }\n    [, ...] | ALL [ PRIVILEGES ] }\n    ON { SEQUENCE \u003cem class=\"replaceable\"\u003e\u003ccode\u003esequence_name\u003c/code\u003e\u003c/em\u003e [, ...]\n         | ALL SEQUENCES IN SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema_name\u003c/code\u003e\u003c/em\u003e [, ...] }\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }\n    ON DATABASE \u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON DOMAIN \u003cem class=\"replaceable\"\u003e\u003ccode\u003edomain_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON FOREIGN DATA WRAPPER \u003cem class=\"replaceable\"\u003e\u003ccode\u003efdw_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON FOREIGN SERVER \u003cem class=\"replaceable\"\u003e\u003ccode\u003eserver_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { EXECUTE | ALL [ PRIVILEGES ] }\n    ON { { FUNCTION | PROCEDURE | ROUTINE } \u003cem class=\"replaceable\"\u003e\u003ccode\u003efunction_name\u003c/code\u003e\u003c/em\u003e [ ( [ [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargmode\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_name\u003c/code\u003e\u003c/em\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_type\u003c/code\u003e\u003c/em\u003e [, ...] ] ) ] [, ...]\n         | ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema_name\u003c/code\u003e\u003c/em\u003e [, ...] }\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON LANGUAGE \u003cem class=\"replaceable\"\u003e\u003ccode\u003elang_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }\n    ON LARGE OBJECT \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { SET | ALTER SYSTEM } [, ...] | ALL [ PRIVILEGES ] }\n    ON PARAMETER \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }\n    ON SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { CREATE | ALL [ PRIVILEGES ] }\n    ON TABLESPACE \u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON TYPE \u003cem class=\"replaceable\"\u003e\u003ccode\u003etype_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ { ADMIN | INHERIT | SET } OPTION FOR ]\n    \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e [, ...] FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\n\u003cspan class=\"phrase\"\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e can be:\u003c/span\u003e\n\n    [ GROUP ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e\n  | PUBLIC\n  | CURRENT_ROLE\n  | CURRENT_USER\n  | SESSION_USER","synopsis_text":"REVOKE [ GRANT OPTION FOR ]\n{ { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }\n[, ...] | ALL [ PRIVILEGES ] }\nON { [ TABLE ] table_name [, ...]\n| ALL TABLES IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | INSERT | UPDATE | REFERENCES } ( column_name [, ...] )\n[, ...] | ALL [ PRIVILEGES ] ( column_name [, ...] ) }\nON [ TABLE ] table_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { USAGE | SELECT | UPDATE }\n[, ...] | ALL [ PRIVILEGES ] }\nON { SEQUENCE sequence_name [, ...]\n| ALL SEQUENCES IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }\nON DATABASE database_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON DOMAIN domain_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON FOREIGN DATA WRAPPER fdw_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON FOREIGN SERVER server_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ EXECUTE | ALL [ PRIVILEGES ] }\nON { { FUNCTION | PROCEDURE | ROUTINE } function_name [ ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) ] [, ...]\n| ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON LANGUAGE lang_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }\nON LARGE OBJECT loid [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SET | ALTER SYSTEM } [, ...] | ALL [ PRIVILEGES ] }\nON PARAMETER configuration_parameter [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }\nON SCHEMA schema_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ CREATE | ALL [ PRIVILEGES ] }\nON TABLESPACE tablespace_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON TYPE type_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ { ADMIN | INHERIT | SET } OPTION FOR ]\nrole_name [, ...] FROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nwhere role_specification can be:\n\n[ GROUP ] role_name\n| PUBLIC\n| CURRENT_ROLE\n| CURRENT_USER\n| SESSION_USER"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"revoke","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"REVOKE","Summary":"撤销访问权限","BodyHTML":"\u003cpre\u003eREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }\n[, ...] | ALL [ PRIVILEGES ] }\nON { [ TABLE ] table_name [, ...]\n| ALL TABLES IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | INSERT | UPDATE | REFERENCES } ( column_name [, ...] )\n[, ...] | ALL [ PRIVILEGES ] ( column_name [, ...] ) }\nON [ TABLE ] table_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { USAGE | SELECT | UPDATE }\n[, ...] | ALL [ PRIVILEGES ] }\nON { SEQUENCE sequence_name [, ...]\n| ALL SEQUENCES IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }\nON DATABASE database_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON DOMAIN domain_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON FOREIGN DATA WRAPPER fdw_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON FOREIGN SERVER server_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ EXECUTE | ALL [ PRIVILEGES ] }\nON { { FUNCTION | PROCEDURE | ROUTINE } function_name [ ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) ] [, ...]\n| ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON LANGUAGE lang_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }\nON LARGE OBJECT loid [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SET | ALTER SYSTEM } [, ...] | ALL [ PRIVILEGES ] }\nON PARAMETER configuration_parameter [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }\nON SCHEMA schema_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ CREATE | ALL [ PRIVILEGES ] }\nON TABLESPACE tablespace_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON TYPE type_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ { ADMIN | INHERIT | SET } OPTION FOR ]\nrole_name [, ...] FROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\n其中role_specification可以是：\n\n[ GROUP ] role_name\n| PUBLIC\n| CURRENT_ROLE\n| CURRENT_USER\n| SESSION_USER\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eREVOKE\u003c/code\u003e 命令从一个或多个角色那里撤销先前授予的权限。关键字 \u003ccode\u003ePUBLIC\u003c/code\u003e 指的是由所有角色组成的隐式定义组。\u003c/p\u003e\u003cp\u003e有关各种权限类型的含义，请参见 \u003ca href=\"/docs/18/sql-grant.html\" title=\"GRANT\" rel=\"nofollow\"\u003e\u003ccode\u003eGRANT\u003c/code\u003e\u003c/a\u003e 命令的描述。\u003c/p\u003e\u003cp\u003e请注意，任何特定角色实际拥有的权限，是直接授予给它的权限、授予给它当前所属任一角色的权限，以及授予给 \u003ccode\u003ePUBLIC\u003c/code\u003e 的权限之和。因此，例如，从 \u003ccode\u003ePUBLIC\u003c/code\u003e 撤销 \u003ccode\u003eSELECT\u003c/code\u003e 权限，并不一定意味着所有角色都失去了该对象上的 \u003ccode\u003eSELECT\u003c/code\u003e 权限：那些被直接授予该权限或通过其他角色获得该权限的角色仍然拥有它。类似地，从某个用户撤销 \u003ccode\u003eSELECT\u003c/code\u003e 权限，如果 \u003ccode\u003ePUBLIC\u003c/code\u003e 或其所属的其他角色仍然拥有 \u003ccode\u003eSELECT\u003c/code\u003e 权限，该用户仍可能使用 \u003ccode\u003eSELECT\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e如果指定了 \u003ccode\u003eGRANT OPTION FOR\u003c/code\u003e，则只撤销该权限的授予选项，而不撤销权限本身。否则，权限和授予选项都会被撤销。\u003c/p\u003e\u003cp\u003e如果某个用户持有带授予选项的权限，并且已经将其授予其他用户，那么其他用户持有的这些权限称为依赖权限。若正在撤销第一个用户持有的该权限或其授予选项，并且存在依赖权限，则在指定 \u003ccode\u003eCASCADE\u003c/code\u003e 时这些依赖权限也会被一并撤销；否则，该撤销操作会失败。此递归撤销只影响那些通过某条可追溯到本 \u003ccode\u003eREVOKE\u003c/code\u003e 命令目标用户的用户链授予的权限。因此，如果受影响用户还通过其他用户获得了同一权限，那么他们实际上可能仍保有该权限。\u003c/p\u003e\u003cp\u003e在撤销某个表上的权限时，该表每一列上的对应列权限（若有）也会自动被撤销。反过来，如果某个角色已被授予表级权限，那么从单独列上撤销同一权限不会产生任何效果。\u003c/p\u003e\u003cp\u003e在撤销角色成员资格时，\u003ccode\u003eGRANT OPTION\u003c/code\u003e 改称为 \u003ccode\u003eADMIN OPTION\u003c/code\u003e，但行为类似。请注意，在 \u003cspan\u003ePostgreSQL\u003c/span\u003e 16 之前的版本中，系统不会跟踪角色成员资格授权所产生的依赖权限，因此 \u003ccode\u003eCASCADE\u003c/code\u003e 对角色成员资格没有效果。现在情况已不再如此。另请注意，这种形式的命令不允许在 \u003cem\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e 中使用噪声词 \u003ccode\u003eGROUP\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e正如可以从现有角色成员资格授权中移除 \u003ccode\u003eADMIN OPTION\u003c/code\u003e 一样，也可以撤销 \u003ccode\u003eINHERIT OPTION\u003c/code\u003e 或 \u003ccode\u003eSET OPTION\u003c/code\u003e。这等价于将相应选项的值设为 \u003ccode\u003eFALSE\u003c/code\u003e。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cp\u003e用户只能撤销由自己直接授予的权限。例如，如果用户 A 已将某项带授予选项的权限授予用户 B，而用户 B 又将其授予用户 C，则用户 A 不能直接从 C 撤销该权限。相反，用户 A 可以从 B 撤销授予选项，并使用 \u003ccode\u003eCASCADE\u003c/code\u003e 选项，这样该权限就会进一步从 C 撤销。再例如，如果 A 和 B 都将同一权限授予了 C，A 可以撤销自己授予的那份，但不能撤销 B 授予的那份，因此 C 实际上仍会拥有该权限。\u003c/p\u003e\u003cp\u003e当对象的非拥有者尝试对该对象执行 \u003ccode\u003eREVOKE\u003c/code\u003e 时，如果该用户在该对象上完全没有任何权限，命令将立即失败。只要该用户至少拥有某项权限，命令就会继续执行，但只会撤销那些该用户持有授予选项的权限。如果未持有任何授予选项，\u003ccode\u003eREVOKE ALL PRIVILEGES\u003c/code\u003e 形式会发出警告；而其他形式在该用户缺少命令中特别列出的某项权限的授予选项时，也会发出警告。（原则上，这些说明也适用于对象拥有者；但由于拥有者始终被视为持有全部授予选项，这种情况实际上不会发生。）\u003c/p\u003e\u003cp\u003e如果超级用户选择执行 \u003ccode\u003eGRANT\u003c/code\u003e 或 \u003ccode\u003eREVOKE\u003c/code\u003e 命令，则该命令会像由受影响对象的拥有者发出那样执行。（由于角色没有拥有者，在 \u003ccode\u003eGRANT\u003c/code\u003e 角色成员资格时，该命令会像由引导超级用户发出那样执行。）由于所有权限最终都来自对象拥有者（可能经由授予选项链间接传递），超级用户可以撤销所有权限，但如上所述，这可能需要使用 \u003ccode\u003eCASCADE\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e\u003ccode\u003eREVOKE\u003c/code\u003e 也可以由并非受影响对象拥有者的角色执行，只要该角色是拥有该对象之角色的成员，或者是持有该对象上 \u003ccode\u003eWITH GRANT OPTION\u003c/code\u003e 权限之角色的成员。在这种情况下，该命令会视同由实际拥有该对象的角色，或持有该对象上 \u003ccode\u003eWITH GRANT OPTION\u003c/code\u003e 权限的角色发出。例如，如果表 \u003ccode\u003et1\u003c/code\u003e 由角色 \u003ccode\u003eg1\u003c/code\u003e 拥有，而角色 \u003ccode\u003eu1\u003c/code\u003e 是 \u003ccode\u003eg1\u003c/code\u003e 的成员，那么 \u003ccode\u003eu1\u003c/code\u003e 可以撤销 \u003ccode\u003et1\u003c/code\u003e 上那些记录为由 \u003ccode\u003eg1\u003c/code\u003e 授出的权限。这包括由 \u003ccode\u003eu1\u003c/code\u003e 以及角色 \u003ccode\u003eg1\u003c/code\u003e 的其他成员作出的授权。\u003c/p\u003e\u003cp\u003e如果执行 \u003ccode\u003eREVOKE\u003c/code\u003e 的角色通过多条角色成员资格路径间接持有权限，则使用哪个上层角色来执行该命令并无规定。在这种情况下，最佳做法是使用 \u003ccode\u003eSET ROLE\u003c/code\u003e 切换成你希望作为其身份执行 \u003ccode\u003eREVOKE\u003c/code\u003e 的那个具体角色。否则，可能会撤销掉并非你本意要撤销的权限，或者根本没有撤销任何权限。\u003c/p\u003e\u003cp\u003e有关具体权限类型以及如何检查对象权限的更多信息，请参见\u003ca href=\"/docs/18/ddl-priv.html\" rel=\"nofollow\"\u003e第 5.8 节\u003c/a\u003e。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e撤销表 \u003ccode\u003efilms\u003c/code\u003e 上授予所有用户的插入权限：\u003c/p\u003e\u003cpre\u003eREVOKE INSERT ON films FROM PUBLIC;\n\u003c/pre\u003e\u003cp\u003e撤销用户 \u003ccode\u003emanuel\u003c/code\u003e 在视图 \u003ccode\u003ekinds\u003c/code\u003e 上的所有权限：\u003c/p\u003e\u003cpre\u003eREVOKE ALL PRIVILEGES ON kinds FROM manuel;\n\u003c/pre\u003e\u003cp\u003e请注意，这实际上意味着\u003cspan\u003e“\u003cspan\u003e撤销所有由我授予的权限\u003c/span\u003e”\u003c/span\u003e。\u003c/p\u003e\u003cp\u003e撤销用户 \u003ccode\u003ejoe\u003c/code\u003e 在角色 \u003ccode\u003eadmins\u003c/code\u003e 中的成员资格：\u003c/p\u003e\u003cpre\u003eREVOKE admins FROM joe;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\u003ca href=\"/docs/18/sql-grant.html\" title=\"GRANT\" rel=\"nofollow\"\u003e\u003ccode\u003eGRANT\u003c/code\u003e\u003c/a\u003e 命令的兼容性注解同样适用于 \u003ccode\u003eREVOKE\u003c/code\u003e。按照标准，关键词 \u003ccode\u003eRESTRICT\u003c/code\u003e 或 \u003ccode\u003eCASCADE\u003c/code\u003e 是必需的，但 \u003cspan\u003ePostgreSQL\u003c/span\u003e 默认假定为 \u003ccode\u003eRESTRICT\u003c/code\u003e。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/grant/?v=18\" title=\"GRANT\" rel=\"nofollow\"\u003e\u003cspan\u003eGRANT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-default-privileges/?v=18\" title=\"ALTER DEFAULT PRIVILEGES\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER DEFAULT PRIVILEGES\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"1b5ca64c","ContentHash":"762b20885b7e855faea0fa396046f291667660d12f453b9b4ef870473f57037e","Payload":{"purpose_zh":"撤销访问权限","sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 命令从一个或多个角色那里撤销先前授予的权限。关键字 \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e 指的是由所有角色组成的隐式定义组。\u003c/p\u003e\u003cp\u003e有关各种权限类型的含义，请参见 \u003ca href=\"/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e 命令的描述。\u003c/p\u003e\u003cp\u003e请注意，任何特定角色实际拥有的权限，是直接授予给它的权限、授予给它当前所属任一角色的权限，以及授予给 \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e 的权限之和。因此，例如，从 \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e 撤销 \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e 权限，并不一定意味着所有角色都失去了该对象上的 \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e 权限：那些被直接授予该权限或通过其他角色获得该权限的角色仍然拥有它。类似地，从某个用户撤销 \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e 权限，如果 \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e 或其所属的其他角色仍然拥有 \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e 权限，该用户仍可能使用 \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e如果指定了 \u003ccode class=\"literal\"\u003eGRANT OPTION FOR\u003c/code\u003e，则只撤销该权限的授予选项，而不撤销权限本身。否则，权限和授予选项都会被撤销。\u003c/p\u003e\u003cp\u003e如果某个用户持有带授予选项的权限，并且已经将其授予其他用户，那么其他用户持有的这些权限称为依赖权限。若正在撤销第一个用户持有的该权限或其授予选项，并且存在依赖权限，则在指定 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 时这些依赖权限也会被一并撤销；否则，该撤销操作会失败。此递归撤销只影响那些通过某条可追溯到本 \u003ccode class=\"literal\"\u003eREVOKE\u003c/code\u003e 命令目标用户的用户链授予的权限。因此，如果受影响用户还通过其他用户获得了同一权限，那么他们实际上可能仍保有该权限。\u003c/p\u003e\u003cp\u003e在撤销某个表上的权限时，该表每一列上的对应列权限（若有）也会自动被撤销。反过来，如果某个角色已被授予表级权限，那么从单独列上撤销同一权限不会产生任何效果。\u003c/p\u003e\u003cp\u003e在撤销角色成员资格时，\u003ccode class=\"literal\"\u003eGRANT OPTION\u003c/code\u003e 改称为 \u003ccode class=\"literal\"\u003eADMIN OPTION\u003c/code\u003e，但行为类似。请注意，在 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 16 之前的版本中，系统不会跟踪角色成员资格授权所产生的依赖权限，因此 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 对角色成员资格没有效果。现在情况已不再如此。另请注意，这种形式的命令不允许在 \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e 中使用噪声词 \u003ccode class=\"literal\"\u003eGROUP\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e正如可以从现有角色成员资格授权中移除 \u003ccode class=\"literal\"\u003eADMIN OPTION\u003c/code\u003e 一样，也可以撤销 \u003ccode class=\"literal\"\u003eINHERIT OPTION\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eSET OPTION\u003c/code\u003e。这等价于将相应选项的值设为 \u003ccode class=\"literal\"\u003eFALSE\u003c/code\u003e。\u003c/p\u003e","key":"description","title":"描述"},{"html":"\u003cp\u003e用户只能撤销由自己直接授予的权限。例如，如果用户 A 已将某项带授予选项的权限授予用户 B，而用户 B 又将其授予用户 C，则用户 A 不能直接从 C 撤销该权限。相反，用户 A 可以从 B 撤销授予选项，并使用 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 选项，这样该权限就会进一步从 C 撤销。再例如，如果 A 和 B 都将同一权限授予了 C，A 可以撤销自己授予的那份，但不能撤销 B 授予的那份，因此 C 实际上仍会拥有该权限。\u003c/p\u003e\u003cp\u003e当对象的非拥有者尝试对该对象执行 \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 时，如果该用户在该对象上完全没有任何权限，命令将立即失败。只要该用户至少拥有某项权限，命令就会继续执行，但只会撤销那些该用户持有授予选项的权限。如果未持有任何授予选项，\u003ccode class=\"command\"\u003eREVOKE ALL PRIVILEGES\u003c/code\u003e 形式会发出警告；而其他形式在该用户缺少命令中特别列出的某项权限的授予选项时，也会发出警告。（原则上，这些说明也适用于对象拥有者；但由于拥有者始终被视为持有全部授予选项，这种情况实际上不会发生。）\u003c/p\u003e\u003cp\u003e如果超级用户选择执行 \u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e 或 \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 命令，则该命令会像由受影响对象的拥有者发出那样执行。（由于角色没有拥有者，在 \u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e 角色成员资格时，该命令会像由引导超级用户发出那样执行。）由于所有权限最终都来自对象拥有者（可能经由授予选项链间接传递），超级用户可以撤销所有权限，但如上所述，这可能需要使用 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e\u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 也可以由并非受影响对象拥有者的角色执行，只要该角色是拥有该对象之角色的成员，或者是持有该对象上 \u003ccode class=\"literal\"\u003eWITH GRANT OPTION\u003c/code\u003e 权限之角色的成员。在这种情况下，该命令会视同由实际拥有该对象的角色，或持有该对象上 \u003ccode class=\"literal\"\u003eWITH GRANT OPTION\u003c/code\u003e 权限的角色发出。例如，如果表 \u003ccode class=\"literal\"\u003et1\u003c/code\u003e 由角色 \u003ccode class=\"literal\"\u003eg1\u003c/code\u003e 拥有，而角色 \u003ccode class=\"literal\"\u003eu1\u003c/code\u003e 是 \u003ccode class=\"literal\"\u003eg1\u003c/code\u003e 的成员，那么 \u003ccode class=\"literal\"\u003eu1\u003c/code\u003e 可以撤销 \u003ccode class=\"literal\"\u003et1\u003c/code\u003e 上那些记录为由 \u003ccode class=\"literal\"\u003eg1\u003c/code\u003e 授出的权限。这包括由 \u003ccode class=\"literal\"\u003eu1\u003c/code\u003e 以及角色 \u003ccode class=\"literal\"\u003eg1\u003c/code\u003e 的其他成员作出的授权。\u003c/p\u003e\u003cp\u003e如果执行 \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 的角色通过多条角色成员资格路径间接持有权限，则使用哪个上层角色来执行该命令并无规定。在这种情况下，最佳做法是使用 \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e 切换成你希望作为其身份执行 \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e 的那个具体角色。否则，可能会撤销掉并非你本意要撤销的权限，或者根本没有撤销任何权限。\u003c/p\u003e\u003cp\u003e有关具体权限类型以及如何检查对象权限的更多信息，请参见\u003ca href=\"/docs/18/ddl-priv.html\" title=\"5.8. 权限\"\u003e第 5.8 节\u003c/a\u003e。\u003c/p\u003e","key":"notes","title":"注解"},{"html":"\u003cp\u003e撤销表 \u003ccode class=\"literal\"\u003efilms\u003c/code\u003e 上授予所有用户的插入权限：\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eREVOKE INSERT ON films FROM PUBLIC;\n\u003c/pre\u003e\u003cp\u003e撤销用户 \u003ccode class=\"literal\"\u003emanuel\u003c/code\u003e 在视图 \u003ccode class=\"literal\"\u003ekinds\u003c/code\u003e 上的所有权限：\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eREVOKE ALL PRIVILEGES ON kinds FROM manuel;\n\u003c/pre\u003e\u003cp\u003e请注意，这实际上意味着\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e撤销所有由我授予的权限\u003c/span\u003e”\u003c/span\u003e。\u003c/p\u003e\u003cp\u003e撤销用户 \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e 在角色 \u003ccode class=\"literal\"\u003eadmins\u003c/code\u003e 中的成员资格：\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eREVOKE admins FROM joe;\n\u003c/pre\u003e","key":"examples","title":"示例"},{"html":"\u003cp\u003e\u003ca href=\"/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e 命令的兼容性注解同样适用于 \u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e。按照标准，关键词 \u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 是必需的，但 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 默认假定为 \u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e。\u003c/p\u003e","key":"compatibility","title":"兼容性"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/grant/?v=18\" title=\"GRANT\"\u003e\u003cspan class=\"refentrytitle\"\u003eGRANT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-default-privileges/?v=18\" title=\"ALTER DEFAULT PRIVILEGES\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER DEFAULT PRIVILEGES\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"另见"}],"sections_same_as":"","synopsis_html":"REVOKE [ GRANT OPTION FOR ]\n    { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }\n    [, ...] | ALL [ PRIVILEGES ] }\n    ON { [ TABLE ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e [, ...]\n         | ALL TABLES IN SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema_name\u003c/code\u003e\u003c/em\u003e [, ...] }\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { SELECT | INSERT | UPDATE | REFERENCES } ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_name\u003c/code\u003e\u003c/em\u003e [, ...] )\n    [, ...] | ALL [ PRIVILEGES ] ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_name\u003c/code\u003e\u003c/em\u003e [, ...] ) }\n    ON [ TABLE ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { USAGE | SELECT | UPDATE }\n    [, ...] | ALL [ PRIVILEGES ] }\n    ON { SEQUENCE \u003cem class=\"replaceable\"\u003e\u003ccode\u003esequence_name\u003c/code\u003e\u003c/em\u003e [, ...]\n         | ALL SEQUENCES IN SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema_name\u003c/code\u003e\u003c/em\u003e [, ...] }\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }\n    ON DATABASE \u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON DOMAIN \u003cem class=\"replaceable\"\u003e\u003ccode\u003edomain_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON FOREIGN DATA WRAPPER \u003cem class=\"replaceable\"\u003e\u003ccode\u003efdw_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON FOREIGN SERVER \u003cem class=\"replaceable\"\u003e\u003ccode\u003eserver_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { EXECUTE | ALL [ PRIVILEGES ] }\n    ON { { FUNCTION | PROCEDURE | ROUTINE } \u003cem class=\"replaceable\"\u003e\u003ccode\u003efunction_name\u003c/code\u003e\u003c/em\u003e [ ( [ [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargmode\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_name\u003c/code\u003e\u003c/em\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_type\u003c/code\u003e\u003c/em\u003e [, ...] ] ) ] [, ...]\n         | ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema_name\u003c/code\u003e\u003c/em\u003e [, ...] }\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON LANGUAGE \u003cem class=\"replaceable\"\u003e\u003ccode\u003elang_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }\n    ON LARGE OBJECT \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { SET | ALTER SYSTEM } [, ...] | ALL [ PRIVILEGES ] }\n    ON PARAMETER \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }\n    ON SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { CREATE | ALL [ PRIVILEGES ] }\n    ON TABLESPACE \u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n    { USAGE | ALL [ PRIVILEGES ] }\n    ON TYPE \u003cem class=\"replaceable\"\u003e\u003ccode\u003etype_name\u003c/code\u003e\u003c/em\u003e [, ...]\n    FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\nREVOKE [ { ADMIN | INHERIT | SET } OPTION FOR ]\n    \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e [, ...] FROM \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e [, ...]\n    [ GRANTED BY \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e ]\n    [ CASCADE | RESTRICT ]\n\n\u003cspan class=\"phrase\"\u003e其中\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_specification\u003c/code\u003e\u003c/em\u003e可以是：\u003c/span\u003e\n\n    [ GROUP ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole_name\u003c/code\u003e\u003c/em\u003e\n  | PUBLIC\n  | CURRENT_ROLE\n  | CURRENT_USER\n  | SESSION_USER","synopsis_text":"REVOKE [ GRANT OPTION FOR ]\n{ { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }\n[, ...] | ALL [ PRIVILEGES ] }\nON { [ TABLE ] table_name [, ...]\n| ALL TABLES IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | INSERT | UPDATE | REFERENCES } ( column_name [, ...] )\n[, ...] | ALL [ PRIVILEGES ] ( column_name [, ...] ) }\nON [ TABLE ] table_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { USAGE | SELECT | UPDATE }\n[, ...] | ALL [ PRIVILEGES ] }\nON { SEQUENCE sequence_name [, ...]\n| ALL SEQUENCES IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }\nON DATABASE database_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON DOMAIN domain_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON FOREIGN DATA WRAPPER fdw_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON FOREIGN SERVER server_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ EXECUTE | ALL [ PRIVILEGES ] }\nON { { FUNCTION | PROCEDURE | ROUTINE } function_name [ ( [ [ argmode ] [ arg_name ] arg_type [, ...] ] ) ] [, ...]\n| ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA schema_name [, ...] }\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON LANGUAGE lang_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }\nON LARGE OBJECT loid [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { SET | ALTER SYSTEM } [, ...] | ALL [ PRIVILEGES ] }\nON PARAMETER configuration_parameter [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }\nON SCHEMA schema_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ CREATE | ALL [ PRIVILEGES ] }\nON TABLESPACE tablespace_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ GRANT OPTION FOR ]\n{ USAGE | ALL [ PRIVILEGES ] }\nON TYPE type_name [, ...]\nFROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\nREVOKE [ { ADMIN | INHERIT | SET } OPTION FOR ]\nrole_name [, ...] FROM role_specification [, ...]\n[ GRANTED BY role_specification ]\n[ CASCADE | RESTRICT ]\n\n其中role_specification可以是：\n\n[ GROUP ] role_name\n| PUBLIC\n| CURRENT_ROLE\n| CURRENT_USER\n| SESSION_USER"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","6.4","6.5","7.0","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
