GRANT
Attention
This page documents an earlier version. Go to the latest (v2.3) version.Synopsis
Use the GRANT
statement to allow access privileges.
Syntax
grant ::= GRANT privileges ON privilege_target TO name [ , ... ]
[ WITH GRANT OPTION ]
grant
Semantics
Not all GRANT
options are supported yet in YSQL, but the following GRANT
option is supported.
GRANT ALL ON DATABASE name TO name;
For the list of possible privileges or privilege_target settings, see REVOKE in the PostgreSQL documentation.
GRANT
Grant privileges on a database object or grant a membership in a role.
privileges
Specify the privileges.
ALL
Grant all of the available privileges.
privilege_target
name
Specify the name of the role.
WITH GRANT OPTION
Specify that the recipient of the privileges can in turn grant them to others. Grant options cannot be granted to PUBLIC
.
Examples
- Grant John all privileges on the
postgres
database.
postgres=# GRANT ALL ON DATABASE postgres TO John;