pgstreamsourcerefers to the user provided in the pgstream source URL.pgstreamtargetrefers to the user provided in the pgstream target URL.
Snapshots
From Xata Database (Snapshots)
Quick Checklist
- Create a source user (
pgstreamsource) with access to required schemas/tables. - For roles without passwords → no special config needed.
- For roles with passwords → must use the
xatasuperuser. - Update YAML config with correct snapshot settings.
Steps
-
User privileges
Ensure the
pgstreamsourceuser (from the pgstream source URL) can access the database schema and tables you need. -
Roles handling
- No roles → no changes required.
- Roles without passwords → no changes required.
-
Roles with passwords → must use the
xatauser aspgstreamsource. ⚠️ Only thexatauser has access to thepg_authidtable required for snapshotting roles with passwords. Without this, you’ll see:
-
Config when not snapshotting roles
If roles are disabled or not manually managed, add the following to avoid failures:
Example full configuration:
xata, xata_superuser) will not be snapshotted.
To Xata Database (Snapshots)
Quick Checklist
- Create a target user (
pgstreamtarget) for the pgstream target URL. - Grant privileges for schema/database ownership.
- Grant optional privileges depending on features (create DB, create roles).
- Use
disable_triggers: false(required for all non-xatausers).
Steps
Thepgstreamtarget user (from the pgstream target URL) must have the following privileges:
-
Schema ownership
-
Database creation (if
create_target_dbis enabled) -
Role creation (if
roles_snapshot_modeisenabled/no_passwords)⚠️pgstreamtargetmust already hold any privileges it assigns (e.g.,REPLICATION). -
Disable triggers (required for Xata)
⚠️ Only the
xatauser can setsession_replication_roleon Xata databases. For all other users, you must disable trigger management in pgstream:❌ If using a non-xatauser withdisable_triggers: true, pgstream will fail with:
Replication
From Xata Database (Replication)
Quick Checklist
- Ensure logical replication is enabled on your Xata database.
- Use the
xatauser for initialization (only user with event trigger privileges). - Optionally use a different
pgstreamsourceuser for streaming.
Steps
-
Enable logical replication
Make sure logical replication is enabled in your database. The
wal_levelmust be set tological. You can check the current setting by running the following:⚠️ Changing wal_level requires a full database restart. -
Replication phases
- Initialization → requires elevated privileges to create schemas, event triggers, and replication slots.
- Streaming → can use a dedicated
pgstreamsourceuser.
Initialization
Initialization does the following:- Creates
pgstreamschema - Creates replication slot (if missing)
- Creates event triggers/functions for schema changes
xata user has sufficient privileges to create event triggers. Use the xata user for initialization:
Streaming
After initialization, you can:- Keep using
xata, or - Transfer ownership to a dedicated
pgstreamsourcerole.
To Xata Database (Replication)
Quick Checklist
- Ensure
pgstreamtargethas schema/database ownership. - If combined with snapshot → follow Snapshot target requirements.
Steps
Privileges required:Troubleshooting
permission denied for table pg_authid
permission denied for table pg_authid
Cause: Roles with passwords require pg_authid access.
Fix: Use
Fix: Use
xata user as source, or disable role passwords (roles_snapshot_mode: no_passwords).permission denied to set parameter "session_replication_role"
permission denied to set parameter "session_replication_role"
Cause: Only the
Fix: Set
xata user can set this parameter.Fix: Set
disable_triggers: false in target config, or use the xata user as target.permission denied for schema public when transferring ownership
permission denied for schema public when transferring ownership
Cause: Target role lacks CREATE privilege on schema.
Fix: Grant CREATE on schema to the role:
Fix: Grant CREATE on schema to the role:
GRANT CREATE ON SCHEMA public TO role_name;Role creation fails
Role creation fails
Cause:
Fix: Grant required privileges to
pgstreamtarget lacks privileges it tries to assign.Fix: Grant required privileges to
pgstreamtarget first, or use a user with more privileges.