PostgreSQL
Minimum PostgreSQL grants for each Nilus pipeline mode: batch read and write, CDC via logical replication, and metadata ingestion.
This page is a provisioning reference for platform and database administrators. It lists the minimum PostgreSQL grants required to run each Nilus pipeline mode against a PostgreSQL depot.
Pipeline modes supported
type: batch
postgresql://
Full or incremental reads and writes
type: cdc
debezium+postgresql://
Log-based change capture via WAL using pgoutput
type: metadata
metadata+postgresql://
Metadata ingestion
Read data: PostgreSQL as source (type: batch)
Nilus uses this pattern when the depot is referenced in source.address of a pipeline configuration. It issues SELECT queries, either a full scan or an incremental read using a cursor column, against the target table.
Minimum grants
-- Database access
GRANT CONNECT ON DATABASE <database_name> TO <user>;
-- Schema access
GRANT USAGE ON SCHEMA <schema_name> TO <user>;
-- Table read: existing tables
GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO <user>;
-- Table read: future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA <schema_name>
GRANT SELECT ON TABLES TO <user>;CDC source: PostgreSQL (type: cdc)
Server-side prerequisite (one-time, requires superuser or admin)
Nilus requires logical replication to be enabled on the PostgreSQL server before it can capture changes through Debezium. Enabling logical replication is a server-level configuration change: it requires a full restart of the PostgreSQL server and cannot be applied at the session level.
Minimum grants
If a superuser or DBA pre-creates the publication instead of letting Nilus create it, the connector still needs to alter or manage the publication during CDC operation. Grant this by assigning ownership of the publication to the CDC user, or by granting CREATE on the database.
Write data: PostgreSQL as destination (type: batch, type: cdc)
Nilus uses this pattern when the depot is referenced in sink.address of a pipeline configuration. It manages table creation and data loading.
Minimum grants (covers all strategies)
Grants by incremental strategy
append
CONNECT, USAGE, INSERT, CREATE (if new table)
merge
CONNECT, USAGE, INSERT, UPDATE, DELETE, SELECT, CREATE (if new table)
replace
CONNECT, USAGE, INSERT, TRUNCATE, CREATE (if new table)
Metadata ingestion: PostgreSQL source connector (type: metadata)
Nilus uses this pattern when the depot is referenced in source.address of a type: metadata pipeline. Nilus drives the PostgreSQL source connector.
Basic metadata (tables, schemas, columns, views)
Usage and lineage: the pg_stat_statements extension
Nilus metadata pipeline reads query history from the pg_stat_statements extension to build lineage and usage statistics. This requires a one-time admin setup and an additional user grant.
Step 1. Enable the extension (admin, requires server restart).
Step 2. Create the extension and grant access (run as superuser after restart).
Stored procedure lineage (additional postgresql.conf change)
To capture SQL executed inside stored procedures:
No additional SQL grants are needed beyond pg_read_all_stats.
Additional grants by workflow type
Basic metadata
SQL grants above
CONNECT, USAGE, SELECT
Usage & lineage
pg_stat_statements enabled + GRANT pg_read_all_stats
pg_stat_statements view
Stored procedure lineage
log_statement = 'all' + pg_stat_statements.track = 'all' in postgresql.conf
Internal query tracking
Permission matrix
Use case
CONNECT DB
USAGE schema
SELECT
INSERT/UPDATE/DELETE
CREATE schema
REPLICATION attr
pg_read_all_stats
Read (source, batch)
Yes
Yes
Yes
No
No
No
No
CDC source
Yes
Yes
Yes (snapshot)
No
Yes (if auto-pub)
Yes
No
Write: append
Yes
Yes
No
INSERT
Yes (if new)
No
No
Write: merge
Yes
Yes
Yes
Yes
Yes (if new)
No
No
Write: replace
Yes
Yes
No
INSERT + TRUNCATE
Yes (if new)
No
No
metadata (basic)
Yes
Yes
Yes
No
No
No
No
usage / lineage
Yes
Yes
Yes
No
No
No
Yes
Notes
REPLICATIONattribute: This is a server-level user attribute set at user creation time (CREATE USER ... WITH REPLICATION). It cannot be granted with a regularGRANTstatement. A superuser or a user withCREATEROLErights must create or alter the CDC user.wal_level = logicalrequires a server restart: This is a server configuration change and cannot be applied at the session level. Coordinate with the database administrator before enabling CDC on a production instance.Publication ownership: Nilus uses
pgoutputand manages the publication lifecycle. If the publication is pre-created, assign ownership to the CDC user, or grant the CDC userCREATEon the database so the connector can alter the publication.ALTER DEFAULT PRIVILEGES: This applies only to objects created by the grantor. If multiple users create tables in the schema, repeat the statement for each table owner to keep access consistent.pg_stat_statementsis not a query log: It evicts entries silently and stores no timestamps. Frequent ingestion scheduling is the primary mitigation.
Last updated
Was this helpful?