REVOKE (Revoke Privileges)

Last updated: 2026-11-04

REVOKE (Revoke Privileges)

REVOKE takes back privileges that were granted earlier, mirroring GRANT. It can withdraw a specific privilege from a role on an object, or withdraw only the WITH GRANT OPTION — keeping the access but stopping it from being passed on.

Kindcommand
Example LanguageSQL

📝 Syntax

REVOKE [GRANT OPTION FOR] { <privilege> | ALL [PRIVILEGES] } ON [TABLE] <table> [, ...]
FROM <role> [, ...]
[CASCADE | RESTRICT]

⚙️ Parameters

GRANT OPTION FORWithdraws only the ability to re-grant
ON <object>The table, sequence, or schema the privilege applies to
FROM <role>The role losing the privilege
PUBLICThe implicit member that stands for every user

Returns:No return value. The privilege stops applying as soon as the statement succeeds.

▶ Example

Runs real PostgreSQL 18 right in your browser (PGlite WASM, nothing to install). Press ▶ Run and the result appears in the panel below.

Output:

DROP TABLE
CREATE TABLE
INSERT 0 2
DO
GRANT
REVOKE
   grantee    | privilege_type
--------------+---------------
report_reader | SELECT

📌 Key Points

More case studies coming soon.

📚 Related Reference

❓ FAQ

QCan the user still reach the data after a REVOKE?
APossibly: the privilege may also arrive via PUBLIC or via another role the user belongs to. Walk every grant path in information_schema.role_table_grants and revoke them one by one.
QHow do I revoke an inherited privilege?
AInherited privileges cannot be revoked directly. Revoke at the source — drop the privilege from the granting role, or remove the user from that role.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

Content reviewed by MOTO · Found an error? Report it

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏