has_language_privilege()

A function determining whether a user has a privilege for a language

has_language_privilege() is a system function determining whether a user has the specified privilege for the specified language.

has_language_privilege() was added in PostgreSQL 7.3.

Usage

has_language_privilege ( [ user name or oid, ] language text, privilege text ) → boolean
has_language_privilege ( [ user name or oid, ] language oid, privilege text ) → boolean

The only privilege which can be queried with has_language_privilege() is: USAGE.

Change history

Examples

Determine if the current user has the USAGE privilege for the specified language:

postgres=# SELECT has_language_privilege('plpgsql', 'USAGE');
 has_language_privilege 
------------------------
 t
(1 row)

Attempting to determine an unrecognized privilege for this object type:

postgres=# SELECT has_language_privilege('plpgsql', 'CREATE');
ERROR:  unrecognized privilege type: "CREATE"

Attempting to determine privileges for a non-existent language:

postgres=# SELECT has_language_privilege('plalgol', 'CREATE');
ERROR:  language "plalgol" does not exist

Categories

Procedural language, System function