Skip to content

PostgreSQL

Connect PostgreSQL single-node or replication deployments as a Cyntex source or target for full-load batch reads and real-time CDC pipelines via logical replication.

Supported versions: PostgreSQL 9.4 – 16
Supported modes: batch, cdc

Prerequisites

Create a database user:

CREATE USER cyntex WITH PASSWORD 'your_password';

Grant read permissions on the target schema:

\c your_database
GRANT SELECT ON ALL TABLES IN SCHEMA public TO cyntex;
GRANT USAGE ON SCHEMA public TO cyntex;

For CDC only — set replica identity to FULL on each table you want to capture (required to capture UPDATE/DELETE with full row data):

ALTER TABLE public.your_table REPLICA IDENTITY FULL;

For CDC only — install a logical decoding plugin. Cyntex supports three options:

PluginMin VersionNotes
wal2json9.4Recommended. Requires primary keys for DELETE sync.
pgoutput10Built-in, no install needed. UPDATE before-image is empty unless REPLICA IDENTITY FULL is set.
decoderbufs9.6Uses Protocol Buffers; more complex setup.

Set WAL level to logical in postgresql.conf:

wal_level = logical

Then restart PostgreSQL and add replication access to pg_hba.conf:

host replication cyntex 0.0.0.0/0 md5

Verify WAL is ready:

SHOW wal_level; -- must return 'logical'

DSL Configuration

apiVersion: cyntex/v1
kind: source
id: my-postgresql
connector: postgresql
mode: cdc # batch | cdc
config:
host: db.internal
port: 5432
database: mydb
schema: public
username: ${PG_USER}
password: ${PG_PASS}
logPluginName: wal2json # wal2json | pgoutput | decoderbufs
# extParams: "" # optional; additional JDBC parameters
# timezone: "0" # optional; default UTC+0
options:
start_from: latest
tables:
- name: users
- name: /orders_.*/

Config Reference

FieldRequiredDefaultDescription
hostYesHostname or IP address of the PostgreSQL server
portYesPostgreSQL service port (typically 5432)
databaseYesDatabase name. One connection maps to one database.
schemaYesSchema name (e.g., public). One connection maps to one schema.
usernameYesPostgreSQL user for authentication
passwordYesPassword for the PostgreSQL user
logPluginNameYes (CDC)Logical decoding plugin: wal2json, pgoutput, or decoderbufs. Required when mode: cdc.
extParamsNoAdditional JDBC connection parameters
timezoneNo0 (UTC)Timezone offset applied to timezone-naive fields (DATE, TIMESTAMP, etc.)

Notes

  • Replication slots: Each CDC task occupies one replication slot in PostgreSQL. Unused slots block WAL log cleanup and can cause disk pressure. Delete or reset tasks that are no longer needed to release slots.
  • wal2json and primary keys: Tables without primary keys cannot have DELETE events captured by wal2json. Either add a primary key or switch to pgoutput with REPLICA IDENTITY FULL.
  • Partition tables: Capturing CDC events from partitioned parent tables requires PostgreSQL 13+ and the pgoutput plugin.
  • Standby reads: To read incremental data from a standby node in a replication setup, select the walminer plugin. Note that walminer requires superuser permissions and does not require wal_level = logical.
  • DDL capture: DDL changes (e.g., ALTER TABLE) are not captured when PostgreSQL is used as a source.
  • Replication slot cleanup: If a CDC task is stopped, its slot remains in PostgreSQL. To free it manually: SELECT pg_drop_replication_slot('slot_name');