Appearance
HAS_SYSTEM_PRIVILEGE
Return true
if the user has the specified privilege on the system.
HAS_SYSTEM_PRIVILEGE([role,], privilege)
If the role
name is omitted, the function returns results for the current user.
Valid privilege values are:
CREATE ROLE
ALTER ANY ROLE
DROP ANY ROLE
CREATE DATABASE
RESTORE ANY DATABASE
Note: This function cannot be used in a query that has a FROM clause (with table references).
For example:
premdb=# select has_system_privilege('bobr','restore any database');
has_system_privilege
----------------------
f
(1 row)
premdb=# grant restore any database on system to bobr;
GRANT
premdb=# select has_system_privilege('bobr','restore any database');
has_system_privilege
----------------------
t
(1 row)
premdb=# grant create database on system to yb100;
GRANT
premdb=# select has_system_privilege('yb100','create database');
has_system_privilege
----------------------
t
(1 row)
Parent topic:System Functions