Grant

Grants access privileges to a user, a group, or to all users in the database.

Synopsis

GRANT privilege [, ...] ON object [, ...]
      TO { PUBLIC | GROUP group | username }

Parameters

privilege

The privilege you wish to grant. Valid privileges are:

SELECT

The privilege allowing the specified user or group to access all columns in a specific table or view.

INSERT

The privilege allowing the specified user or group to insert data into all columns of a specified table.

UPDATE

The privilege allowing the specified user or group to update all columns of a specified table.

DELETE

The privilege allowing the specified user or group to delete rows from a specific table.

RULE

The privilege allowing the specified user or group to delete rules from a specified table or rule.

ALL

A shorthand way to grant all of the previous privileges to the specified user or group.

object

The name of the object upon which you are granting privileges. Valid object types are tables, views, and sequences.

PUBLIC

The optional PUBLIC keyword indicates that privilege be granted to all users of the database.

group

The name of a group to receive the privileges that you are granting.

username

The name of a PostgreSQL user to receive the privileges that you are granting. You can use PUBLIC here to represent all users.

Results

CHANGE

The message returned when a target is successfully granted the specified privileges.

ERROR: ChangeAcl: class "object" not found

The error returned if object is not found in the connected database.

ERROR: aclparse: non-existent ...

Get Practical PostgreSQL now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.