HAS_TABLE_PRIVILEGE
Return
true
if the user has the specified privilege for the specified
table.HAS_TABLE_PRIVILEGE([role,] table, privilege)
If the role
name is omitted, the function returns results for the current
user. The value public
is allowed as a role name. The table name may also
specify the schema (schema.table
).
Valid privilege values are:
SELECT
INSERT
UPDATE
DELETE
TRUNCATE
REFERENCES
Note: This function cannot be used in a query that has a FROM clause (a query that has table
references).
For
example:
premdb=# select has_table_privilege('bobr','match','select');
has_table_privilege
---------------------
f
(1 row)
premdb=# select has_table_privilege('match','select');
has_table_privilege
---------------------
t
(1 row)