> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# REVOKE

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The `REVOKE` <InternalLink path="sql-statements">statement</InternalLink> revokes <InternalLink path="security-reference/authorization#managing-privileges">privileges</InternalLink> from <InternalLink path="security-reference/authorization#users-and-roles">users and/or roles</InternalLink>. For the list of privileges that can be granted to and revoked from users and roles, see <InternalLink path="grant">`GRANT`</InternalLink>.

You can use `REVOKE` to directly revoke privileges from a role or user, or you can revoke membership to an existing role, which effectively revokes that role's privileges.

<Note>
  The \`\` statement performs a schema change. For more information about how online schema changes work in CockroachDB, see <InternalLink path="online-schema-changes">Online Schema Changes</InternalLink>.
</Note>

## Syntax

<img src="https://mintcdn.com/cockroachlabs/M1Nto-joXUTgisRs/images/sql-diagrams/v25.3/revoke.svg?fit=max&auto=format&n=M1Nto-joXUTgisRs&q=85&s=f4196cee88281b878c0ca0a1b822ee86" alt="revoke syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="1311" height="1417" data-path="images/sql-diagrams/v25.3/revoke.svg" />

### Parameters

| Parameter                   | Description                                                                                                                                                                                                                                      |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `ALL`<br />`ALL PRIVILEGES` | Revoke all [privileges](#supported-privileges).                                                                                                                                                                                                  |
| `privilege_list`            | A comma-separated list of <InternalLink path="security-reference/authorization#managing-privileges">privileges</InternalLink> to revoke.                                                                                                         |
| `grant_targets`             | A comma-separated list of database, table, sequence, or function names. The list should be preceded by the object type (e.g., `DATABASE mydatabase`). If the object type is not specified, all names are interpreted as table or sequence names. |
| `target_types`              | A comma-separated list of <InternalLink path="create-type">user-defined types</InternalLink>.                                                                                                                                                    |
| `ALL SEQUENCES IN SCHEMA`   | Revoke [privileges](#supported-privileges) on all sequences in a schema or list of schemas.                                                                                                                                                      |
| `ALL TABLES IN SCHEMA`      | Revoke [privileges](#supported-privileges) on all tables and sequences in a schema or list of schemas.                                                                                                                                           |
| `ALL FUNCTIONS IN SCHEMA`.  | Revoke [privileges](#supported-privileges) on all <InternalLink path="user-defined-functions">user-defined functions</InternalLink> in a schema or list of schemas.                                                                              |
| `schema_name_list`          | A comma-separated list of <InternalLink path="create-schema">schemas</InternalLink>.                                                                                                                                                             |
| `role_spec_list`            | A comma-separated list of <InternalLink path="security-reference/authorization#users-and-roles">roles</InternalLink>.                                                                                                                            |

## Supported privileges

The following privileges can be revoked:

| Privilege                                                         | Levels                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ----------------------------------------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ALL`                                                             | System, Database, Schema, Table, Sequence, Type | For the object to which `ALL` is applied, grants all privileges at the system, database, schema, table, sequence, or type level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `BACKUP`                                                          | System, Database, Table                         | Grants the ability to create <InternalLink path="backup-and-restore-overview">backups</InternalLink> at the system, database, or table level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| <a id="bypassrls" /> `BYPASSRLS`                                  | Table                                           | Grants the ability to bypass <InternalLink path="row-level-security">row-level security (RLS)</InternalLink> policies on a table. This privilege controls the access from an RLS perspective only; the user also needs sufficient <InternalLink path="grant">`GRANT`</InternalLink> privileges to read or write to the table.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `CANCELQUERY`                                                     | System                                          | Grants the ability to cancel queries.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `CHANGEFEED`                                                      | Table                                           | Grants the ability to create <InternalLink path="change-data-capture-overview">changefeeds</InternalLink> on a table.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <a id="connect" /> `CONNECT`                                      | Database                                        | Grants the ability to view a database's metadata, which consists of objects in a database's `information_schema` and `pg_catalog` system catalogs. This allows the role to view the database's table, schemas, user-defined types, and list the database when running `SHOW DATABASES`. The `CONNECT` privilege is also required to run backups of the database.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `CONTROLJOB`                                                      | System                                          | Grants the ability to <InternalLink path="pause-job">pause</InternalLink>, <InternalLink path="resume-job">resume</InternalLink>, and <InternalLink path="cancel-job">cancel</InternalLink> jobs. Non-admin roles cannot control jobs created by admin roles.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `CREATE`                                                          | Database, Schema, Table, Sequence               | Grants the ability to create objects at the database, schema, table, or sequence level. When applied at the database level, grants the ability to configure <InternalLink path="zone-config-extensions">multi-region zone configs</InternalLink>. In CockroachDB v23.2 and later, the <InternalLink path="cluster-settings">cluster setting</InternalLink> `sql.auth.public_schema_create_privilege.enabled` controls whether users receive `CREATE` privileges on the public schema or not. The setting applies at the time that the <InternalLink path="create-schema">public schema is created</InternalLink>, which happens whenever <InternalLink path="create-database">a database is created</InternalLink>. The setting is `true` by default, but can be set to `false` for increased compatibility with [PostgreSQL version 15](https://www.postgresql.org/about/news/postgresql-15-released-2526/) as described in [this commit](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b073c3ccd06e4cb845e121387a43faa8c68a7b62). |
| `CREATEDB`                                                        | System                                          | Grants the ability to <InternalLink path="create-database">create</InternalLink> or <InternalLink path="alter-database#rename-to">rename</InternalLink> a database.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `CREATELOGIN`                                                     | System                                          | Grants the ability to manage authentication using the `WITH PASSWORD`, `VALID UNTIL`, and `LOGIN`/`NOLOGIN` role options.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `CREATEROLE`                                                      | System                                          | Grants the ability to <InternalLink path="create-role">create</InternalLink>, modify, or <InternalLink path="drop-role">delete</InternalLink> non-admin roles.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `DELETE`                                                          | Table, Sequence                                 | Grants the ability to delete objects at the table or sequence level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `DROP`                                                            | Database, Table, Sequence                       | Grants the ability to drop objects at the database, table, or sequence level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `EXECUTE`                                                         | Function                                        | Grants the ability to execute <InternalLink path="functions-and-operators">functions</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `EXTERNALCONNECTION`                                              | System                                          | Grants the ability to connect to external systems such as object stores, key management systems, Kafka feeds, or external file systems. Often used in conjunction with the `BACKUP`, `RESTORE`, and `CHANGEFEED` privilege.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `EXTERNALIOIMPLICITACCESS`                                        | System                                          | Grants the ability to interact with external resources that require implicit access.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `INSERT`                                                          | Table, Sequence                                 | Grants the ability to insert objects at the table or sequence level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| <a id="modifyclustersetting" /> `MODIFYCLUSTERSETTING`            | System                                          | Grants the ability to modify <InternalLink path="cluster-settings">cluster settings</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `MODIFYSQLCLUSTERSETTING`                                         | System                                          | Grants the ability to modify SQL <InternalLink path="cluster-settings">cluster settings</InternalLink> (cluster settings prefixed with `sql.`).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `NOSQLLOGIN`                                                      | System                                          | Prevents roles from connecting to the SQL interface of a cluster.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| **Deprecated** `REPLICATION`                                      | System                                          | As of v25.2 `REPLICATION` is **deprecated**. Instead, use the `REPLICATIONSOURCE` and `REPLICATIONDEST` privileges at the table level. Grants the ability to create a <InternalLink path="logical-data-replication-overview">logical data replication</InternalLink> or <InternalLink path="physical-cluster-replication-overview">physical cluster replication</InternalLink> stream.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| <a id="repaircluster" /> `REPAIRCLUSTER`, `REPAIRCLUSTERMETADATA` | System                                          | Grants the ability to perform cluster debugging and repair operations, including: edit <InternalLink path="show-create-schedule">scheduled jobs</InternalLink>, edit <InternalLink path="show-create-external-connection">external connections</InternalLink>, <InternalLink path="ui-transactions-page#transaction-statistics">reset SQL statistics</InternalLink>, update <InternalLink path="configure-replication-zones">zone configurations</InternalLink>, <InternalLink path="alter-range#relocate">relocate ranges</InternalLink>, and check for constraint violations with <InternalLink version="releases" path="cockroachdb-feature-availability">`SCRUB`</InternalLink>. See also: [`VIEWCLUSTERMETADATA`](#viewclustermetadata).                                                                                                                                                                                                                                                                                                            |
| <a id="replicationdest" /> `REPLICATIONDEST`                      | Table                                           | Grants the ability to run logical data replication into an existing table on the destination cluster. For more details, refer to the <InternalLink path="set-up-logical-data-replication">Set Up Logical Data Replication</InternalLink> tutorial.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <a id="replicationsource" /> `REPLICATIONSOURCE`                  | Table                                           | Grants the ability to run logical data replication from a table on the source cluster. For more details, refer to the <InternalLink path="set-up-logical-data-replication">Set Up Logical Data Replication</InternalLink> tutorial.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `RESTORE`                                                         | System, Database                                | Grants the ability to restore <InternalLink path="backup-and-restore-overview">backups</InternalLink> at the system or database level. Refer to `RESTORE` <InternalLink path="restore#required-privileges">Required privileges</InternalLink> for more details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `SELECT`                                                          | Table, Sequence                                 | Grants the ability to run <InternalLink path="query-data">selection queries</InternalLink> at the table or sequence level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `TRIGGER`                                                         | Table                                           | Grants the ability to create <InternalLink path="triggers">triggers</InternalLink> on a table.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `UPDATE`                                                          | Table, Sequence                                 | Grants the ability to run <InternalLink path="update-data">update statements</InternalLink> at the table or sequence level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `USAGE`                                                           | Schema, Sequence, Type                          | Grants the ability to use <InternalLink path="schema-design-overview">schemas</InternalLink>, <InternalLink path="create-sequence">sequences</InternalLink>, or <InternalLink path="create-type">user-defined types</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <a id="viewactivity" /> `VIEWACTIVITY`                            | System                                          | Grants the ability to view other user's activity statistics of a cluster.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <a id="viewactivityredacted" /> `VIEWACTIVITYREDACTED`            | System                                          | Grants the ability to view other user's activity statistics, but prevents the role from accessing the statement diagnostics bundle in the DB Console, and viewing some columns in introspection queries that contain data about the cluster.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <a id="viewclustermetadata" /> `VIEWCLUSTERMETADATA`              | System                                          | Grants the ability to view range information, data distribution, store information, and Raft information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <a id="viewclustersetting" /> `VIEWCLUSTERSETTING`                | System                                          | Grants the ability to view <InternalLink path="cluster-settings">cluster settings</InternalLink> and their values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <a id="viewdebug" /> `VIEWDEBUG`                                  | System                                          | Grants the ability to view the <InternalLink path="ui-debug-pages">Advanced Debug Page</InternalLink> of the DB Console and work with the debugging and profiling endpoints.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <a id="viewjob" /> `VIEWJOB`                                      | System                                          | Grants the ability to view <InternalLink path="show-jobs">jobs</InternalLink> on the cluster.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `VIEWSYSTEMTABLE`                                                 | System                                          | Grants read-only access (`SELECT`) on all tables in the `system` database, without granting the ability to modify the cluster. This privilege was introduced in v23.1.11.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `ZONECONFIG`                                                      | Database, Table, Sequence                       | Grants the ability to configure <InternalLink path="configure-replication-zones">replication zones</InternalLink> at the database, table, and sequence level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

## Required privileges

* To revoke privileges, user revoking privileges must have the `GRANT` privilege on the target <InternalLink path="create-database">database</InternalLink>, <InternalLink path="create-schema">schema</InternalLink>, <InternalLink path="create-table">table</InternalLink>, or <InternalLink path="enum">user-defined type</InternalLink>. In addition to the `GRANT` privilege, the user revoking privileges must have the privilege being revoked on the target object. For example, a user revoking the `SELECT` privilege on a table to another user must have the `GRANT` and `SELECT` privileges on that table.

* To revoke role membership, the user revoking role membership must be a role admin (i.e., members with the `WITH ADMIN OPTION`) or a member of the `admin` role. To remove membership to the `admin` role, the user must have `WITH ADMIN OPTION` on the `admin` role.

## Considerations

* The `root` user cannot be revoked from the `admin` role.

## Known limitations

User/role management operations (such as <InternalLink path="grant">`GRANT`</InternalLink> and <InternalLink path="revoke">`REVOKE`</InternalLink>) are <InternalLink path="online-schema-changes">schema changes</InternalLink>. As such, they inherit the <InternalLink path="online-schema-changes">limitations of schema changes</InternalLink>.

For example, schema changes wait for concurrent <InternalLink path="transactions">transactions</InternalLink> using the same resources as the schema changes to complete. In the case of <InternalLink path="security-reference/authorization#roles">role memberships</InternalLink> being modified inside a transaction, most transactions need access to the set of role memberships. Using the default settings, role modifications require schema leases to expire, which can take up to 5 minutes.

This means that <InternalLink path="query-behavior-troubleshooting#hanging-or-stuck-queries">long-running transactions</InternalLink> elsewhere in the system can cause user/role management operations inside transactions to take several minutes to complete. This can have a cascading effect. When a user/role management operation inside a transaction takes a long time to complete, it can in turn block all user-initiated transactions being run by your application, since the user/role management operation in the transaction has to commit before any other transactions that access role memberships (i.e., most transactions) can make progress.

If you want user/role management operations to finish more quickly, and do not care whether concurrent transactions will immediately see the side effects of those operations, set the <InternalLink path="set-vars">session variable</InternalLink> `allow_role_memberships_to_change_during_transaction` to `true`.

When this session variable is enabled, any user/role management operations issued in the current session will only need to wait for the completion of statements in other sessions where `allow_role_memberships_to_change_during_transaction` is not enabled.

To accelerate user/role management operations across your entire application, you have the following options:

1. Set the session variable in all sessions by <InternalLink path="connection-parameters#supported-options-parameters">passing it in the client connection string</InternalLink>.
2. Apply the `allow_role_memberships_to_change_during_transaction` setting globally to an entire cluster using the <InternalLink path="alter-role#set-default-session-variable-values-for-all-users">`ALTER ROLE ALL`</InternalLink> statement:

   ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
   ALTER ROLE ALL SET allow_role_memberships_to_change_during_transaction = true;
   ```

## Examples

#### Setup

To follow along, run <InternalLink path="cockroach-demo">`cockroach demo`</InternalLink> to start a temporary, in-memory cluster with the <InternalLink path="movr">`movr`</InternalLink> sample dataset preloaded:

```shell theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
$ cockroach demo
```

### Revoke privileges on databases

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE USER max WITH PASSWORD 'roach';
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
GRANT CREATE ON DATABASE movr TO max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON DATABASE movr;
```

```
  database_name | grantee | privilege_type | is_grantable
----------------+---------+----------------+---------------
  movr          | admin   | ALL            |      t
  movr          | max     | CREATE         |      f
  movr          | root    | ALL            |      t
(3 rows)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
REVOKE CREATE ON DATABASE movr FROM max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON DATABASE movr;
```

```
  database_name | grantee | privilege_type | is_grantable
----------------+---------+----------------+---------------
  movr          | admin   | ALL            |      t
  movr          | root    | ALL            |      t
(2 rows)
```

<Note>
  Any tables that previously inherited the database-level privileges retain the privileges.
</Note>

### Revoke privileges on specific tables in a database

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
GRANT ALL ON TABLE rides TO max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON TABLE rides;
```

```
  database_name | schema_name | table_name | grantee | privilege_type | is_grantable
----------------+-------------+------------+---------+----------------+---------------
  movr          | public      | rides      | admin   | ALL            |      t
  movr          | public      | rides      | max     | ALL            |      f
  movr          | public      | rides      | root    | ALL            |      t
(3 rows)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
REVOKE ALL ON TABLE rides FROM max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON TABLE rides;
```

```
  database_name | schema_name | table_name | grantee | privilege_type | is_grantable
----------------+-------------+------------+---------+----------------+---------------
  movr          | public      | rides      | admin   | ALL            |      t
  movr          | public      | rides      | root    | ALL            |      t
(2 rows)
```

### Revoke privileges on all tables in a database or schema

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
GRANT ALL ON TABLE rides, users TO max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON TABLE movr.*;
```

```
  database_name | schema_name |         table_name         | grantee | privilege_type | is_grantable
----------------+-------------+----------------------------+---------+----------------+---------------
  movr          | public      | promo_codes                | admin   | ALL            |      t
  movr          | public      | promo_codes                | root    | ALL            |      t
  movr          | public      | rides                      | admin   | ALL            |      t
  movr          | public      | rides                      | max     | ALL            |      f
  movr          | public      | rides                      | root    | ALL            |      t
  movr          | public      | user_promo_codes           | admin   | ALL            |      t
  movr          | public      | user_promo_codes           | root    | ALL            |      t
  movr          | public      | users                      | admin   | ALL            |      t
  movr          | public      | users                      | max     | ALL            |      f
  movr          | public      | users                      | root    | ALL            |      t
  movr          | public      | usertable                  | admin   | ALL            |      t
  movr          | public      | usertable                  | root    | ALL            |      t
  movr          | public      | vehicle_location_histories | admin   | ALL            |      t
  movr          | public      | vehicle_location_histories | root    | ALL            |      t
  movr          | public      | vehicles                   | admin   | ALL            |      t
  movr          | public      | vehicles                   | public  | SELECT         |      f
  movr          | public      | vehicles                   | root    | ALL            |      t
(17 rows)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
REVOKE ALL ON ALL TABLES IN SCHEMA public FROM max;
```

This is equivalent to the following syntax:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
REVOKE ALL ON movr.public.* FROM max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON TABLE movr.*;
```

```
  database_name | schema_name |         table_name         | grantee | privilege_type | is_grantable
----------------+-------------+----------------------------+---------+----------------+---------------
  movr          | public      | promo_codes                | admin   | ALL            |      t
  movr          | public      | promo_codes                | root    | ALL            |      t
  movr          | public      | rides                      | admin   | ALL            |      t
  movr          | public      | rides                      | root    | ALL            |      t
  movr          | public      | user_promo_codes           | admin   | ALL            |      t
  movr          | public      | user_promo_codes           | root    | ALL            |      t
  movr          | public      | users                      | admin   | ALL            |      t
  movr          | public      | users                      | root    | ALL            |      t
  movr          | public      | usertable                  | admin   | ALL            |      t
  movr          | public      | usertable                  | root    | ALL            |      t
  movr          | public      | vehicle_location_histories | admin   | ALL            |      t
  movr          | public      | vehicle_location_histories | root    | ALL            |      t
  movr          | public      | vehicles                   | admin   | ALL            |      t
  movr          | public      | vehicles                   | public  | SELECT         |      f
  movr          | public      | vehicles                   | root    | ALL            |      t
(15 rows)
```

### Revoke system-level privileges on the entire cluster

<InternalLink path="security-reference/authorization#supported-privileges">System-level privileges</InternalLink> live above the database level and apply to the entire cluster.

`root` and <InternalLink path="security-reference/authorization#admin-role">`admin`</InternalLink> users have system-level privileges by default, and are capable of revoking it from other users and roles using the `REVOKE` statement.

For example, the following statement removes the ability to use the <InternalLink path="set-cluster-setting">`SET CLUSTER SETTING`</InternalLink> statement from the user `maxroach` by revoking the `MODIFYCLUSTERSETTING` system privilege:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
REVOKE SYSTEM MODIFYCLUSTERSETTING FROM max;
```

### Revoke privileges on schemas

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE SCHEMA cockroach_labs;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
GRANT ALL ON SCHEMA cockroach_labs TO max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON SCHEMA cockroach_labs;
```

```
  database_name |  schema_name   | grantee | privilege_type | is_grantable
----------------+----------------+---------+----------------+---------------
  movr          | cockroach_labs | admin   | ALL            |      t
  movr          | cockroach_labs | max     | ALL            |      t
  movr          | cockroach_labs | root    | ALL            |      t
(3 rows)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
REVOKE CREATE ON SCHEMA cockroach_labs FROM max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON SCHEMA cockroach_labs;
```

```
  database_name |  schema_name   | grantee | privilege_type | is_grantable
----------------+----------------+---------+----------------+---------------
  movr          | cockroach_labs | admin   | ALL            |      t
  movr          | cockroach_labs | max     | USAGE          |      t
  movr          | cockroach_labs | root    | ALL            |      t
(3 rows)
```

### Revoke privileges on user-defined types

To revoke privileges on <InternalLink path="create-type">user-defined types</InternalLink>, use the following statements.

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE TYPE status AS ENUM ('available', 'unavailable');
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
GRANT ALL ON TYPE status TO max;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON TYPE status;
```

```
  database_name | schema_name | type_name | grantee | privilege_type | is_grantable
----------------+-------------+-----------+---------+----------------+---------------
  movr          | public      | status    | admin   | ALL            |      t
  movr          | public      | status    | max     | ALL            |      f
  movr          | public      | status    | public  | USAGE          |      f
  movr          | public      | status    | root    | ALL            |      t
(4 rows)
```

### Revoke role membership

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE ROLE developer WITH CREATEDB;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE USER abbey WITH PASSWORD 'lincoln';
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
GRANT developer TO abbey;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON ROLE developer;
```

```
  role_name | member | is_admin
------------+--------+-----------
  developer | abbey  |    f
(1 row)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
REVOKE developer FROM abbey;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON ROLE developer;
```

```
SHOW GRANTS ON ROLE 0
```

### Revoke the admin option

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
GRANT developer TO abbey WITH ADMIN OPTION;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON ROLE developer;
```

```
  role_name | member | is_admin
------------+--------+-----------
  developer | abbey  |    t
(1 row)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
REVOKE ADMIN OPTION FOR developer FROM abbey;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW GRANTS ON ROLE developer;
```

```
  role_name | member | is_admin
------------+--------+-----------
  developer | abbey  |    f
(1 row)
```

## See also

* <InternalLink path="authorization">Authorization</InternalLink>
* <InternalLink path="grant">`GRANT`</InternalLink>
* <InternalLink path="show-grants">`SHOW GRANTS`</InternalLink>
* <InternalLink path="show-roles">`SHOW ROLES`</InternalLink>
* <InternalLink path="create-user">`CREATE USER`</InternalLink>
* <InternalLink path="drop-user">`DROP USER`</InternalLink>
* <InternalLink path="sql-statements">SQL Statements</InternalLink>
