GRANT (Database)

Grants the right to create schemas within the database to a user or role. By default, only the superuser has the right to create a database schema.

Syntax

GRANT { ... { CREATE [, ...]
... | { TEMP } 
... | ALL [ PRIVILEGES ] 
... | CONNECT } }
... ON DATABASE database-name [, ...]
... TO { username | rolename } [, ...] 
... [ WITH GRANT OPTION ]  

Parameters

CREATE

Allows the user to create schemas within the specified database.

TEMP

Allows the user to create temporary tables in the database.

CONNECT

Allows the user to connect to a database.

ALL

Applies to all privileges.

PRIVILEGES

Is for SQL standard compatibility and is ignored.

database-name

Identifies the database in which to grant the privilege.

username | rolename

Grants the privilege to the specified user or role.

WITH GRANT OPTION

Allows the recipient of the privilege to grant it to other users.

Example

The following example grants user Fred the right to create schemas on vmartdb.

=> GRANT CREATE ON DATABASE vmartdb TO Fred;