pg_permissions
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_permissions | 1.4.1 | ADMIN | BSD-2-Clause | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5140 | pg_permissions | No | Yes | No | Yes | No | No | - |
Latest PGDG RPM/catalog version is 1.4.1; PGDG DEB remains on 1.4.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 1.4.1 | 1817161514 | pg_permissions | - |
| RPM | PGDG | 1.4.1 | 1817161514 | pg_permissions_$v | - |
| DEB | PGDG | 1.4 | 1817161514 | postgresql-$v-pg-permissions | - |
Install
You can install pg_permissions directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
pg_permissions: view object permissions and compare them with the desired state
pg_permissions lets you review actual permissions on database objects and compare them against a desired permission state.
Define Desired Permissions
Insert entries into permission_target to describe what permissions should exist:
Set object_name or column_name to NULL to apply to all objects of that type in the schema.
Find Permission Differences
Returns rows where missing = TRUE (permission should exist but doesn’t) or missing = FALSE (extra permission that shouldn’t exist).
Review Actual Permissions
Available views (all with the same column structure):
database_permissions– permissions on the current databaseschema_permissions– permissions on schemastable_permissions– permissions on tablesview_permissions– permissions on viewscolumn_permissions– permissions on table/view columnsfunction_permissions– permissions on functionssequence_permissions– permissions on sequencesall_permissions– UNION of all above
Grant/Revoke via Views
The granted column of the permission views is updatable – updating it executes the appropriate GRANT or REVOKE command.
Note: superusers are not shown in the views (they automatically have all permissions).
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)