GRANT (view)
Grants view privileges to users and roles.
Syntax
GRANT { privilege[,...] | ALL [ PRIVILEGES ] [ EXTEND ] }
ON [[database.]schema.]view[,...]
TO grantee[,...]
[ WITH GRANT OPTION ]
Parameters
privilege``- The following privileges are valid for views:
ALL [PRIVILEGES][EXTEND]- Grants all view 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.view- The target view.
granteeWho is granted privileges, one of the following:
WITH GRANT OPTIONAllows the grantee to grant and revoke the same privileges to other users or roles. 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.
Note
As view owner, you can grant other users SELECT privilege on the view only if one of the following is true:
-
You own the view's base table.
-
You have SELECT...WITH GRANT OPTION privilege on the view's base table.
Examples
Grant user Joe all privileges on view ship.
=> CREATE VIEW ship AS SELECT * FROM public.shipping_dimension;
CREATE VIEW
=> GRANT ALL PRIVILEGES ON ship TO Joe;
GRANT PRIVILEGE