Use SVV_RELATION_PRIVILEGES to view the relation (tables and views) permissions that are explicitly granted to users, roles, and groups in the current database.

SVV_RELATION_PRIVILEGES is visible to all users. Superusers can see all rows. Regular users who have the ACCESS SYSTEM TABLE permission can see all rows. Regular users can only see identities to which they have access or for which they are the identities owner.

Table columns

Column name Data type Description
namespace_name text The name of the namespace where a specified relation exists.
relation_name text The name of the relation.
privilege_type text The type of the permission. Possible values are INSERT, SELECT, UPDATE, DELETE, REFERENCES, or DROP.
identity_id integer The ID of the identity. Possible values are user ID, role ID, or group ID.
identity_name text The name of the identity.
identity_type text The type of the identity. Possible values are user, role, group, or public.
admin_option boolean A value that indicates whether the user can grant the permission to other users and roles. It is always false for the role and group identity type.

Sample query

The following example displays the result of the SVV_RELATION_PRIVILEGES.

SELECT namespace_name,relation_name,privilege_type,identity_name,identity_type,admin_option FROM svv_relation_privileges WHERE relation_name = 'orders' AND privilege_type = 'SELECT'; namespace_name | relation_name | privilege_type | identity_name | identity_type | admin_option ----------------+---------------+----------------+----------------+---------------+-------------- public | orders | SELECT | reguser | user | False public | orders | SELECT | role1 | role | False