Skip to Content
Practical PostgreSQL
book

Practical PostgreSQL

by Joshua D. Drake, John C. Worsley
January 2002
Intermediate to advanced
640 pages
16h 39m
English
O'Reilly Media, Inc.
Content preview from Practical PostgreSQL

Revoke

Revokes access privileges from a user, a group, or all users.

Synopsis

REVOKE privilege [, ...]
    ON object [, ...]
    FROM { PUBLIC | GROUP groupname | username }

Parameters

privilege

A privilege to revoke. Specify SELECT, INSERT, UPDATE, or DELETE to revoke the privilege to use the corresponding command. Use RULE to revoke the privilege to create rules on a table. Use ALL to remove all privileges on a table or other object.

object

The name of the object from which you wish to revoke privileges. This object can be a table, view, or sequence.

group

The name of a group from which to revoke privileges.

user

The name of a PostgreSQL user from which to revoke privileges.

PUBLIC

The keyword that revokes specified privileges from all PostgreSQL users.

Results

CHANGE

The message returned when privileges are successfully revoked.

ERROR: Relation 'object' does not exist

The error returned if object does not exist in the connected database.

ERROR: aclparse: non-existent user "user"

The error returned if user does not exist.

ERROR: non-existent group "group"

The error returned if group does not exist.

Description

Use REVOKE to remove privileges to an object of which you are the owner. You can revoke privileges from a specific user, from a group, or from all users (by specifying the PUBLIC keyword).

Example

The following example revokes INSERT privileges on the books table from a user guest:

booktown=# REVOKE INSERT ON guest FROM books;
CHANGE
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PostgreSQL: Up and Running, 2nd Edition

PostgreSQL: Up and Running, 2nd Edition

Regina O. Obe, Leo S. Hsu
Learning PostgreSQL 11 - Third Edition

Learning PostgreSQL 11 - Third Edition

Christopher Travers, Andrey Volkov
Learn PostgreSQL

Learn PostgreSQL

Luca Ferrari, Enrico Pirozzi
PostgreSQL High Performance Cookbook

PostgreSQL High Performance Cookbook

Dinesh Kumar, Chitij Chauhan

Publisher Resources

ISBN: 9781449309770Supplemental ContentErrata Page