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 ALL with two optional keywords:

  • PRIVILEGES conforms with the SQL standard.
  • EXTEND extends the semantics of ALL to include DROP privileges. An unqualified ALL excludes this privilege. This option enables backward compatibility with GRANT ALL usage in pre-9.2.1 Vertica releases.

To execute functions inside the library, users must also have separate EXECUTE privileges on them, and USAGE privileges on their respective schemas.

[database.]schema

Database and schema. The default schema is public. If you specify a database, it must be the current database.

library

The target library.

grantee

Specifies who is granted privileges, one of the following:

WITH GRANT OPTION

Gives grantee the 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.

Example

Grant USAGE privileges on the MyFunctions library to Fred:

=> GRANT USAGE ON LIBRARY MyFunctions TO Fred; 

See Also