Skip to content

HAS_SCHEMA_PRIVILEGE

Return true if the user has the specified privilege for the specified schema.

HAS_SCHEMA_PRIVILEGE([role,] schema, privilege)

If the role name is omitted, the function returns results for the current user.

Valid privilege values are:

  • CREATE
  • USAGE

Note: This function cannot be used in a query that has a FROM clause (with table references).

For example:

premdb=# select has_schema_privilege('ybd','bobr','create');
 has_schema_privilege 
----------------------
 t
(1 row)

premdb=# select has_schema_privilege('bobr','usage');
 has_schema_privilege 
----------------------
 t
(1 row)

Parent topic:System Functions