Skip to main content

Syntax

pgschema understands the following GRANT/REVOKE features:
  • Table privileges: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER
  • Column-level privileges: SELECT, INSERT, UPDATE, REFERENCES on specific columns
  • Sequence privileges: USAGE, SELECT, UPDATE
  • Function/Procedure privileges: EXECUTE (with function signature)
  • Type/Domain privileges: USAGE
  • WITH GRANT OPTION: Allow grantee to grant the same privileges to others
  • REVOKE GRANT OPTION FOR: Revoke only the grant option while keeping the privilege
  • PUBLIC: Special grantee representing all roles

Examples

Grant table privileges

Grant column-level privileges

Grant function privileges

Grant sequence privileges

Grant type privileges

Alter privileges

Revoke grant option

Canonical Format

When generating migration SQL, pgschema produces privileges in the following canonical format:
Key characteristics of the canonical format:
  • Always includes explicit TABLE keyword for table privileges
  • Privileges are sorted alphabetically (e.g., DELETE, INSERT, SELECT, UPDATE)
  • Function signatures include parameter names when available
  • Each privilege change is a separate statement (no combining multiple roles)