GRANT (Library)

Grants privileges on a library to a database user or role. Only the superuser can grant privileges to a library. To execute functions inside the library, a user must have separate EXECUTE privileges for those functions.

For example, when working with the Connector Framework Service you may 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 { USAGE | ALL }
   ON LIBRARY [ [ db-name.]schema.]library-name [, ...] 
   TO { username | role | PUBLIC } [, ...] 

Parameters

{ USAGE | ALL } 

The type of privilege to grant on the library, valid values are:

  • USAGE
  • ALL
[[ db-name.]schema-name.]

Specifies a schema. If multiple schemas are defined in the database, include the schema name. For example:

myschema.thisDbObject
library-name

The library on which to grant the privilege. If using more than one schema, you must specify the schema that where the library resides.

{ username | role | PUBLIC } [,...]

The recipient of the privileges, valid values are:

  • username—Assigns privileges to a specific user
  • role—Assigns privileges to a role
  • PUBLIC—Assigns privileges to all users and roles.

Example

The following command grants USAGE privileges on the idolLib library in the v_idol schema to user1:

=> GRANT USAGE ON LIBRARY v_idol.IdolLib TO user1;