GRANT (library)
Grants privileges on one or more libraries to users and roles.
For example, when working with the Connector Framework Service, you might need to grant a user usage privileges to a library to be able to set UDSession parameters. For more information see Implementing CFS.
Syntax
GRANT privilege
ON LIBRARY [[database.]schema.]library[,...]
TO grantee[,...]
[ WITH GRANT OPTION ]
Arguments
privilege- Privilege to grant, one of:
-
USAGE: Grants access to functions in the specified libraries. -
DROP: Grants permission to drop libraries that the grantee created. -
ALL [PRIVILEGES] [EXTEND]: Grants all library 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 DROP privileges. An unqualifiedALLexcludes this privilege. This option enables backward compatibility withGRANT ALLusage in pre-9.2.1 Vertica releases.
Important
To execute functions inside the library, users must also have separateEXECUTEprivileges on them, andUSAGEprivileges on their respective schemas. -
[database.]schemaDatabase and schema. The default schema is
public. If you specify a database, it must be the current database.library- The target library.
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
Grant USAGE privileges on the MyFunctions library to Fred:
=> GRANT USAGE ON LIBRARY MyFunctions TO Fred;