Sources

PostgreSQL

Check which PostgreSQL versions SQL Flow can capture from, and what logical replication needs on your server.

SQL Flow captures changes from PostgreSQL through logical replication with the built-in pgoutput plugin. There is one capture mode, so the decisions on this page are about whether your server can run it.

Supported versions

VersionSupported
PostgreSQL 14 and laterYes
PostgreSQL 13 and earlierNo. SQL Flow uses a version of the logical replication protocol that PostgreSQL 14 introduced.

Managed services

Managed PostgreSQL services such as Amazon RDS and Aurora, Azure Database for PostgreSQL and Google Cloud SQL can be sources when they meet the same requirements as any other server:

  • wal_level = logical and a positive max_slot_wal_keep_size, set through the service's server parameters.
  • A capture login with replication rights: the REPLICATION attribute, or membership in the service's replication role, such as rds_replication on Amazon RDS and Aurora.
  • With Encryption at Require (default), a server certificate the agent can validate. If the service's certificates come from its own certificate authority, the agent host needs that authority's certificate. See Logical replication: Encrypted data.

Capture modes

ModeWhat it readsWhat you install on the database host
Logical replicationRow changes decoded by PostgreSQL from the write-ahead log (WAL), streamed to the agent through a replication slot and a publication that SQL Flow createsNothing

The wizard shows no Capture mode choice for PostgreSQL. When you pick PostgreSQL on the Source step, the form asks for Host, Port (default 5432), Database, Username, a password or a secret reference, and Encryption.

Choosing a capture mode

PostgreSQL has a single capture mode. Answer these questions to check that your server can run it.

  1. Is the server PostgreSQL 14 or later?
    • No: upgrade the server.
    • Yes: go to question 2.
  2. Can you set wal_level = logical and restart the server? Logical decoding is impossible without it.
    • No: PostgreSQL can't be a SQL Flow source.
    • Yes: go to question 3.
  3. Can you set max_slot_wal_keep_size to a positive size? SQL Flow refuses to create a replication slot while WAL retention is unbounded, because an abandoned slot could otherwise fill the server's disk.
    • No: PostgreSQL can't be a SQL Flow source.
    • Yes: go to question 4.
  4. Can the capture login have replication rights and own (or be a member of the role that owns) the captured tables? PostgreSQL only lets a table's owner add it to a publication.
Logical replication
Server settingswal_level = logical, positive max_slot_wal_keep_size, a free replication slot
LoginReplication rights, SELECT on the tables, ownership of the tables
Installed on the database hostNothing
Holds on the sourceA logical replication slot, which retains WAL until SQL Flow confirms it
Before-images of updates and deletesKey columns by default; the whole row with REPLICA IDENTITY FULL
TRUNCATECaptured

See Choosing a capture mode for the comparison across every source engine.

Encrypted data

Logical replication
Encrypted connectionRequired by default, with the server certificate and host name validated. Encryption at Prefer relaxes this.
Storage-level encryptionNot visible to SQL Flow: the server decodes changes before it sends them.
Column values encrypted by the application or with pgcryptoCaptured and copied as stored, that is, as ciphertext

See Logical replication: Encrypted data for the Encryption choices and private certificate authorities, and Encrypted data support for every engine.

See also

Previous
Native CDC

If this was useful,
our newsletter will be too.

Get monthly insights on data engineering, AI, and building critical infrastructure - direct from the Spectral Core team and CEO Damir Bulic.