Skip to main content

PostgreSQL and Sybase Replication Permission Guide

This document summarizes common permission requirements for replication scenarios involving PostgreSQL and Sybase, including the following links:

  • Sybase > PostgreSQL
  • PostgreSQL Sybase
  • Sybase > PostgreSQL (Bidirectional)

How To Use This Guide

  • This guide focuses on the permissions commonly needed to create tasks, pass prechecks, and keep tasks running stably.
  • Full permissions usually include both schema permissions and full-data permissions. Incremental permissions extend full permissions with CDC or logical-replication related capabilities.
  • Enterprise environments may also enforce IP allowlists, SSL, audit policies, or object-owner restrictions, so the final authority should still be the console precheck result and your DBA policy.

Quick Reference Table

DatabaseScenarioCommon Source PermissionsCommon Target PermissionsNotes
PostgreSQLSchemaIf views, functions, triggers, or other objects are involved, SUPERUSER is recommendedIf writes involve TABLESPACE, FOREIGN KEY, TYPE, or similar objects, use the DB owner or SUPERUSER; if the target database does not exist yet, CREATEDB is also requiredApplies when PostgreSQL acts as either the source or the target
PostgreSQLFullUSAGE on schema + SELECT on tablesRead/write permissions on the target database; if foreign-key dependencies require trigger disabling, PostgreSQL >= 15 needs GRANT SET ON PARAMETER session_replication_role, and PostgreSQL < 15 needs SUPERUSERFull permissions include both schema permissions and full-data permissions
PostgreSQLIncrementalREPLICATION + DB Owner or SUPERUSERRead/write permissions on the target database; if the target database does not exist yet, CREATEDB / CREATEROLE is also required; if trigger disabling is needed, PostgreSQL >= 15 needs GRANT SET ON PARAMETER session_replication_role, and PostgreSQL < 15 needs SUPERUSERWhen DDL replication is enabled, only the SUPERUSER option can be used
SybaseFullSELECTSELECT, INSERT, DELETE, TRUNCATEApplies to full tasks when Sybase acts as either the source or the target
SybaseIncrementalsa_role; bidirectional tasks also require sso_roleSELECT, INSERT, DELETE, TRUNCATE; if trigger disabling is required, replication_role is also neededsso_role is additionally needed when bidirectional replication creates the extra schema

PostgreSQL Permissions

Permission Details

ScenarioCommon Source PermissionsCommon Target PermissionsNotes
SchemaIf views, functions, triggers, or other objects are involved, SUPERUSER is recommendedIf writes involve TABLESPACE, FOREIGN KEY, TYPE, or similar objects, use the DB owner or SUPERUSER; if the target database does not exist yet, CREATEDB is also requiredSchema permissions are usually prerequisites for both full and incremental tasks
FullUSAGE on schema + SELECT on tablesRead/write permissions on the target database; if trigger disabling is needed, PostgreSQL >= 15 needs GRANT SET ON PARAMETER session_replication_role, and PostgreSQL < 15 needs SUPERUSERFull permissions include both schema permissions and full-data permissions
IncrementalREPLICATION + DB Owner or SUPERUSERRead/write permissions on the target database; if the target database does not exist yet, CREATEDB / CREATEROLE is also required; if trigger disabling is needed, PostgreSQL >= 15 needs GRANT SET ON PARAMETER session_replication_role, and PostgreSQL < 15 needs SUPERUSERWhen DDL replication is enabled, only the SUPERUSER option can be used

Common Grant Examples

  • Schema-Related

    -- If views, functions, triggers, or similar objects are involved, SUPERUSER is recommended on the source
    ALTER ROLE sync_user WITH SUPERUSER;

    -- Target option 1: DB owner
    for each db:
    GRANT <db_owner> TO sync_user;
    ALTER ROLE sync_user WITH CREATEDB;

    -- Target option 2: SUPERUSER
    ALTER ROLE sync_user WITH SUPERUSER;
  • Full Replication

    -- Source: read tables in schema repl_db
    GRANT USAGE ON SCHEMA repl_db TO sync_user;
    GRANT SELECT ON ALL TABLES IN SCHEMA repl_db TO sync_user;

    -- Target: if foreign-key dependencies require triggers to be disabled and PostgreSQL >= 15
    GRANT SET ON PARAMETER session_replication_role TO sync_user;

    -- Target: if foreign-key dependencies require triggers to be disabled and PostgreSQL < 15
    ALTER ROLE sync_user WITH SUPERUSER;
  • Incremental Replication

    -- Source option 1: REPLICATION + DB Owner
    ALTER ROLE sync_user WITH REPLICATION;
    for each db:
    GRANT <db_owner> TO sync_user;

    -- Source option 2: SUPERUSER
    ALTER ROLE sync_user WITH SUPERUSER;

    -- Target: if the target database does not exist yet, CREATE DB and role privileges are also required
    CREATE USER sync_user WITH CREATEDB CREATEROLE PASSWORD 'sync_user';

    -- Target: if foreign-key dependencies exist and PostgreSQL >= 15
    GRANT SET ON PARAMETER session_replication_role TO sync_user;

    -- Target: PostgreSQL < 15 requires SUPERUSER
    ALTER ROLE sync_user WITH SUPERUSER;
tip

If DDL replication is enabled, only the SUPERUSER option can be used.

Runtime Permission Notes

RoleScenarioSystem Behavior or OperationCommon Required Permission
SourceFullRead all replicated tablesSELECT
SourceIncrementalCreate a replication slot by running SELECT * FROM pg_create_logical_replication_slot('<slot>', 'pgoutput');REPLICATION
SourceIncrementalSet REPLICA IDENTITY FULL by running ALTER TABLE <table> REPLICA IDENTITY FULL;Table owner
SourceIncrementalCreate a publication by running CREATE PUBLICATION <pub> FOR TABLE <table>[, <table>]; or CREATE PUBLICATION <pub> FOR ALL TABLES;Table owner, CREATE ON DATABASE, or SUPERUSER
SourceIncrementalCreate the _nd_repl_ schema and nd_repl_de_cycle_v3 table for bidirectional replicationDB owner or CREATE ON DATABASE
SourceIncrementalEnable DDL capture by running CREATE EVENT TRIGGER xxx;SUPERUSER
TargetFullWrite to and clear target tablesSELECT, INSERT, TRUNCATE
TargetIncrementalApply row-level synchronized writesSELECT, INSERT, UPDATE, DELETE

Sybase Permissions

Permission Details

ScenarioCommon Source PermissionsCommon Target PermissionsNotes
FullSELECTSELECT, INSERT, DELETE, TRUNCATEBasic DML permissions for full tasks
Incrementalsa_role; if bidirectional replication creates the extra schema, sso_role is also requiredSELECT, INSERT, DELETE, TRUNCATE; if triggers are disabled, replication_role is also requiredExtra role permissions are needed for bidirectional replication and trigger control

Common Grant Examples

-- Incremental source
GRANT sa_role TO {user_name};
GRANT sso_role TO {user_name};

-- Incremental target
GRANT replication_role TO {user_name};