Skip to main content

Postgres

The Postgres integration replicates data from your PostgreSQL database into RevOS. It supports several ways of picking up changes, including Change Data Capture (CDC) with logical replication and replication based on the xmin system column.

Prerequisites​

Before you start, make sure you have:

  • Access to a PostgreSQL database (version 10 or higher).
  • A database user with read-only privileges and replication rights.
Important

You can't build a table directly from an integration. Once the integration has synced, first create a semantic model based on its data — then you can build tables.

Create a read-only user​

We recommend a dedicated read-only user for RevOS. Run the following SQL:

CREATE USER <username> PASSWORD '<password>';
GRANT CONNECT ON DATABASE <database_name> TO <username>;
GRANT USAGE ON SCHEMA <schema_name> TO <username>;
GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO <username>;
ALTER DEFAULT PRIVILEGES IN SCHEMA <schema_name> GRANT SELECT ON TABLES TO <username>;

Replace <username>, <password>, <database_name>, and <schema_name> with your own values.

Configure the integration in RevOS​

In RevOS, open Integrations, click Add Data Source and select Postgres (see Integrations Page Overview). Then fill in:

  1. Connection details:

    • Name: a descriptive name for the integration.
    • Host: the address of your PostgreSQL server.
    • Port: 5432 by default.
    • Database Name: the name of the PostgreSQL database.
    • Username: the user with read access.
    • Password: the password for that user.
    • Schemas: the schemas to replicate. Leave empty to replicate all schemas the user can access.

    Postgres integration settings in RevOS with host, port, database and user fields

  2. Optional settings:

    • JDBC URL Parameters: extra connection options, as key=value pairs separated by &.
    • SSL Mode: how the connection is encrypted (disable, allow, prefer, require, verify-ca, verify-full).

    JDBC URL parameters field and SSL mode options

  3. Update method:

    • Read Changes using Write-Ahead Log (CDC) (recommended): continuously replicates changes in the database. Requires a replication slot and a publication — see Set up Change Data Capture.
    • Detect Changes with Xmin System Column: uses the xmin system column — a good fit for small databases or when logical replication isn't available.
    • Scan Changes with User Defined Cursor: picks up new and updated rows using a column you choose.

    Update method options for the Postgres integration

    With CDC, also fill in:

    FieldWhat to enter
    Pluginpgoutput
    Replication SlotThe replication slot you created (e.g. revos_slot)
    PublicationThe publication you created (e.g. revos_pub)
    Initial Waiting Time300 seconds; increase it if your first sync is very large
    Queue Size10000; raise it for databases with a sustained high volume of changes
  4. Click Connect. RevOS checks the credentials, that it can reach the database and, with CDC, that the replication slot and publication exist. If the check succeeds, the integration becomes active and RevOS starts the first sync.

Set up Change Data Capture (CDC)​

RevOS does not create the replication slot or the publication — both must exist before you connect. To use CDC with logical replication:

  1. Enable logical replication. In postgresql.conf, set wal_level to logical, and make sure both max_replication_slots and max_wal_senders are greater than zero. Restart the server, then check the setting:

    SHOW wal_level; -- should output "logical"

    On a managed database (such as AlloyDB) you set wal_level through the provider's database flags instead — see AlloyDB for PostgreSQL.

  2. Create a replication slot and a publication with any SQL client:

    -- replication slot
    SELECT pg_create_logical_replication_slot('revos_slot', 'pgoutput');

    -- publication (all tables)
    CREATE PUBLICATION revos_pub FOR ALL TABLES;

    You can use other names (lowercase letters, digits and underscores) — enter the same names in RevOS.

  3. Give the user replication rights if it doesn't have them yet (needs admin privileges):

    ALTER ROLE <username> WITH REPLICATION;

For more on these settings, see the PostgreSQL documentation on logical replication.

Connect through an SSH tunnel​

If RevOS can't reach the database directly (e.g. it has no public IP), connect through an SSH tunnel:

  1. In the integration form, choose SSH Key Authentication or SSH Password Authentication.
  2. Provide the SSH host, port (usually 22), and the tunnel user's credentials.

Before you fall back to SSH, check that your firewall allows inbound traffic on the database port from the RevOS IP addresses. Only use SSH if a direct, encrypted connection is impossible.

Common issues and fixes​

SymptomLikely causeFix
connection refusedWrong host/port or firewallDouble-check the host, open the database port, or connect through an SSH tunnel.
FATAL: password authentication failedWrong user or passwordRe-enter the credentials; test them with psql.
ERROR: logical decoding requires wal_level >= logicalLogical replication not enabledSet wal_level to logical (see CDC setup), then restart the server.
ERROR: replication slot "revos_slot" does not existSlot missing or name mismatchCheck the name (pg_replication_slots) or create the slot.
TLS handshake errorsSSL mode mismatchUse require or verify-full; make sure CA certificates are trusted.

Useful queries while debugging:

-- List replication slots
SELECT slot_name, active FROM pg_replication_slots;

-- Drop a stale slot
SELECT pg_drop_replication_slot('revos_slot');

Limitations and recommendations​

  • PostgreSQL version: version 10 and above is supported. CDC is recommended for version 10+.
  • Performance: replication speed depends on your server configuration and data volume. Test before relying on it in production.
  • Security: when using SSL, prefer the verify-ca or verify-full modes for secure data transfer.