A system 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.


has_language_privilege() has two forms:

  • has_language_privilege(language TEXT or OID, privilege TEXT)
  • has_language_privilege(user TEXT or OID, language TEXT or OID, privilege TEXT)

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

Change history


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

postgres=# SELECT has_language_privilege('plpgsql', 'USAGE');
(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


Procedural language, System function