Roles, users, and permissions

CREATE ROLE/USER, GRANT, privilege functions, pg_roles — the complete v0.1.0 access model.

Version
Latest
v0.1.0 · latest 2 min read
On this page
  1. Model in one paragraph
  2. CREATE ROLE / USER — parses
  3. GRANT — one form supported
  4. Privilege introspection (stubbed true)
  5. What CTOs/architects should know

Model in one paragraph#

v0.1.0 has authentication (who connects: SCRAM/MD5/cleartext via plomid-server --username/--password/--auth) and catalog visibility (pg_roles, pg_user, has_*_privilege stubs returning true so tools browse). It does not have enforced object-level authorization. GRANT records membership; nothing checks it at query time.

CREATE ROLE / USER — parses#

textsource
CREATE ROLE|USER name [LOGIN|NOLOGIN] [PASSWORD 'x'] [...]
sqlsource
CREATE ROLE analyst LOGIN PASSWORD 'secret';
CREATE USER etl LOGIN PASSWORD 'secret';
CREATE ROLE readonly NOLOGIN;

CreateStatement::Role { name, login, password }. No role-based connection gating in v0.1.0 — server --username/--password remains the gate. COMMENT ON ROLE name IS '...' accepted.

GRANT — one form supported#

textsource
GRANT role TO member
sqlsource
GRANT analyst TO etl;

Source: crates/sql/src/parser/grant.rs → Statement::GrantRole → QueryResult::Created("GRANT ROLE") (ddl.rs:1055). Any other GRANT shape (GRANT SELECT ON t TO r, GRANT ALL PRIVILEGES) is not implemented — it errors at parse.

Privilege introspection (stubbed true)#

sqlsource
SELECT has_table_privilege('orders', 'SELECT');      -- true (stub)
SELECT has_schema_privilege('public', 'USAGE');      -- true
SELECT has_database_privilege('plomid', 'CONNECT');  -- true
SELECT * FROM pg_roles;
SELECT * FROM pg_user;

func_has_privilege (crates/types/src/func.rs:217) accepts any arity and returns true so DBeaver/psql catalog browsing never aborts. Do not read this as "all access granted by policy" — it means no privilege enforcement exists to deny.

What CTOs/architects should know#

Expectation v0.1.0 reality
Separate DB users with passwords Server single identity; use network isolation + secrets mgmt
GRANT SELECT enforcement Not enforced; enforce in app/service layer
Audit of who did what Connection/query logs (connection_id, statement type, duration); values never logged
Future RBAC Roadmap, not documented as supported

Related: Run the server (auth modes) · pg_catalog · Compatibility

Was this page helpful?