GRANT (sequence)
Grants sequence privileges to users and roles.
Syntax
GRANT { privilege[,...] | ALL [ PRIVILEGES ] [ EXTEND ] }
ON {
SEQUENCE [[database.]schema.]sequence[,...]
| ALL SEQUENCES IN SCHEMA [database.]schema[,...] }
TO grantee[,...]
[ WITH GRANT OPTION ]
Parameters
privilege- The following privileges are valid for sequences:
-
SELECT: Execute functions CURRVAL and NEXTVAL on the specified sequences.
-
ALTER: Modify a sequence's DDL with ALTER SEQUENCE
-
DROP: Drop this sequence with DROP SEQUENCE.
-
ALL [PRIVILEGES][EXTEND]- Grants all sequence privileges that also belong to the grantor. Grantors cannot grant privileges that they themselves lack
You can qualify
ALLwith two optional keywords:-
PRIVILEGESconforms with the SQL standard. -
EXTENDextends the semantics ofALLto include ALTER and DROP privileges. An unqualifiedALLexcludes these two privileges. This option enables backward compatibility withGRANT ALLusage in pre-9.2.1 Vertica releases.
-
[database.]schemaDatabase and schema. The default schema is
public. If you specify a database, it must be the current database.SEQUENCEsequence- Specifies the sequence on which to grant privileges.
ALL SEQUENCES IN SCHEMAschema``- Grants the specified privileges on all sequences in schema
schema. granteeSpecifies who is granted privileges, one of the following:
- [user‑name](/en/admin/db-users-and-privileges/db-users/)
- [role](/en/admin/db-users-and-privileges/db-roles/)
-
PUBLIC: Default role of all users
WITH GRANT OPTIONGives
granteethe privilege to grant the same privileges to other users or roles, and also revoke them. For details, see Granting privileges.
Privileges
Non-superusers require USAGE on the schema and one of the following:
-
Owner
-
Privileges grantee given the option (
WITH GRANT OPTION) of granting privileges to other users or roles.
Examples
This example shows how to grant user Joe all privileges on sequence my_seq.
=> CREATE SEQUENCE my_seq START 100;
CREATE SEQUENCE
=> GRANT ALL PRIVILEGES ON SEQUENCE my_seq TO Joe;
GRANT PRIVILEGE