Skip to main content

Overview

The OLake Go Postgres Source connector supports multiple synchronization modes. It offers features like parallel chunking, checkpointing, and automatic resume for failed full loads. This connector can be used within the OLake UI or run locally via Docker for open-source workflows.

Integration guides

Tested, step-by-step guides take Postgres to Apache Iceberg, Snowflake, Databricks, BigQuery, Redshift, ClickHouse and DuckDB, each from a pipeline that was run end to end.

Sync Modes Supported​

  • Full Refresh
  • Full Refresh + CDC
  • CDC Only
  • Full Refresh + Incremental
wal2json is not supported

OLake Go reads changes through the native pgoutput plugin. The older wal2json-based CDC method is no longer supported.

Prerequisites​

Version Prerequisites​

A Postgres server version 10 or above is required.

CDC Prerequisite​

To set up PostgreSQL, follow the appropriate setup guide for your PostgreSQL environment:

Connection Prerequisites​

  • Read access to the tables for the PostgreSQL user.
  • For Supabase related setup, refer the Connecting to Supabase section.

After initial Prerequisites are fulfilled, the configurations for PostgreSQL can be configured.


Configuration​

1. Navigate to the Source Configuration Page​

  1. Complete the OLake UI Setup Guide
  2. After logging in to the OLake UI, select the Sources tab from the left sidebar.
  3. Click Create Source on the top right corner.
  4. Select Postgres from the connector dropdown
  5. Provide a name for this source.

2. Provide Configuration Details​

  • Enter Postgres credentials.

    Form for creating a Postgres source in OLake Go, showing fields for endpoint configuration, authentication, and connection options

Change data capture (CDC)​

FieldDescriptionExample Value
Enable CDCEnables change data capture to sync like inserts, updates, and deletes. When enabled, CDC-specific fields appear below. When disabled, supports only Full Refresh and Incremental sync modes.Enabled (default)
Replication Slot required for CDCLogical replication slot (pgoutput) that retains WAL segments until read, ensuring consistent CDC.olake-repl-slot
Publication required for CDCName of the PostgreSQL publication that defines which tables and operations (INSERT, UPDATE, DELETE, TRUNCATE) to replicate. Must exist in the same database as the replication slot and include all tables for CDC capture.postgres_pub
Initial Wait TimeIdle timeout in seconds for pgoutput log reading. Default: 10800 (3 hours) and the minimum is 120. A lower value falls back to the default.120
Preserve TOAST ValuesWhen an UPDATE operation leaves a TOAST column unchanged, Postgres omits it. OLake Go writes __olake_unavailable_value__ for that column. With the toggle ON, OLake Go reads that record's previous value from the Iceberg destination and writes that value instead, so the unchanged column still shows its last real value.Off (Default)
Preserve TOAST Values
  • Requires the OLake Go Postgres source v1.2.0 or later and OLake UI v0.9.3 or later.
  • Preserve TOAST Values can only be set when creating the source and cannot be changed afterwards.
  • When enabled, the available update types are restricted to Positional Deletes (pos) and Deletion Vectors (dv).

Connection details​

FieldDescriptionExample Value
Postgres Host requiredHostname or IP address of the Postgres database server.pg-host
Postgres Port requiredTCP port on which the Postgres listener is accepting connections.5432
Database Name requiredThe name of the target database to connect to.olake-db
Username requiredDatabase user used to authenticate the connection.pg-user
Password requiredThe password corresponding to the provided username for authentication.pgpwd
SchemasList of schemas for discovery. Helps avoid reading all schemas by limiting discovery to only the specified ones. When omitted, all accessible non-system schemas are discovered.public,analytics
JDBC URL ParametersExtra JDBC URL parameters for fine-tuning the connection.{"connect_timeout":"20"}
SSL ModeDefines whether the connection to the database is encrypted over TLS/SSL. Needed to meet security requirements and connect to databases that do not allow plain-text traffic.
  • require
  • disable
  • verify-ca
  • verify-full
Certificate InputDefines how TLS/SSL certificates are provided. Paste the PEM content, or give the file path of each certificate. For Certificate File Path, mount the files first: Docker Compose or Kubernetes. The three certificate fields below must all use the same method.
  • Inline Certificate (PEM) (default)
  • Certificate File Path
Server CA Certificate
or
Server CA Certificate Path
CA certificate for server verification.
  • Inline: Paste the PEM content.
  • Path: File path to the certificate.
Inline: <PEM content>

Path: /etc/ssl/custom-certs/ca.pem
Client Certificate
or
Client Certificate Path
Client certificate for mutual TLS authentication. Set together with Client Key.
  • Inline: Paste the PEM content.
  • Path: File path to the certificate.
Inline: <PEM content>

Path: /etc/ssl/custom-certs/client.pem
Client Key
or
Client Key Path
Client private key for mutual TLS authentication.
  • Inline: Paste the PEM content.
  • Path: File path to the key.
Inline: <PEM content>

Path: /etc/ssl/custom-certs/client.key

Additional configuration​

FieldDescriptionExample Value
Max ThreadsMaximum number of worker threads the connector can spin up for parallel tasks.10
Retry CountNumber of retry attempts for transient failures during connection or sync operations.3
SSH ConfigConfigure OLake Go to connect through an SSH tunnel.
  • No Tunnel
  • SSH Key Authentication
  • SSH Password Authentication
Important: Unique Replication Slot Required

Do not reuse the same replication slot and publication across multiple OLake Go jobs. Sharing them will result in data loss and inconsistencies.

3. Test Connection​

  • Click Set up source to validate the configuration. The test performs two checks:

    Testing Source Configuration modal showing connection success and required CDC prerequisite checks for wal_level, replication_privilege, replication_slot, and publication
    1. Connection validation: Verifies that OLake Go can reach the Postgres server using the provided host, port, credentials, and SSL settings.

    2. CDC prerequisites validation (when CDC is enabled): Evaluates required server-side settings to ensure reliable CDC operation:

      • wal_level: Must be set to logical
      • replication_privilege: User must have replication privileges
      • replication_slot: The specified replication slot must exist
      • publication: The specified publication must exist and include the required tables
  • If any required check fails, the test connection will show the current and recommended values. Fix the server-side settings and retry the connection.

  • If all checks pass, the Postgres source is created successfully. Jobs can then be configured using this source.

  • In case of connection failure, refer to the Troubleshooting section.


Preserving TOAST Values​

When It Works​

SetupLarge values kept?
Sync ModeCDC and Strict CDC only. Full refresh and incremental read whole rows, so TOAST preservation is not needed.

Note: For Strict CDC inserts are read back from the destination, but updates to non-TOAST columns may still write __olake_unavailable_value__ for unchanged TOAST columns.
Stream in append modeNo, there is no prior row to read back from
Table with REPLICA IDENTITY FULLNot needed, Postgres sends the full row
wal2json pluginNot supported (deprecated)
info

When Preserve TOAST Values is enabled, syncs may take longer. For each update that leaves a large column unchanged, OLake reads the previous value from the destination.

Why you should not change this setting after syncs have run

The OLake UI disables this field once the source is created. The CLI does not enforce this. source.json stays editable and OLake will not block the change. Changing it after syncs have run causes data discrepancies:

  • Turning it on later: values synced earlier already hold __olake_unavailable_value__ in the destination, so turning it on will not bring back the intended value.
  • Turning it off later: updates from then on write the placeholder again. Values that were already kept stay as they are.
  • Upgrading an existing source's connector version: the toggle stays at whatever value it was set to and does not reset. To start preserving TOAST values for a source that was created with it off, create a new source instead of upgrading.

Data Type Mapping​

PostgreSQL Data TypesDestination Data Type
int, int2, int4, smallint, integer, serial, serial2, serial4int
bigint, bigserial, int8, serial8bigint
float, float4, realfloat
numeric(p,s), decimal(p,s) with p up to 38decimal(p,s)
numeric(p,s) with a negative scale, such as numeric(10,-2)decimal(p-s,0), such as decimal(12,0)
numeric(p,s) with a scale above the precisiondecimal(s,s)
numeric without a precision, numeric(39-1000,s), and a negative scale whose whole numbers pass 38 digits, such as numeric(38,-5)double
double precision, float8double
booleanboolean
date, timestamp without time zone, timestamp with time zonetimestamptz
money, box, bpchar, char, character, character varying, json, jsonb, jsonpath, name, numrange, path, text, tid, tsquery, tsrange, tstzrange, uuid, varbit, varchar, xml, inet, bit, int2vector, daterange, time with time zone, time without time zonestring
Decimal columns
  • New jobs: jobs created on OLake Go v1.2.0 and above land these columns as decimal(p,s).
  • Existing jobs: jobs created on an older version keep these columns as double. To switch them to decimal(p,s), upgrade to OLake Go v1.2.0 and above and run Clear Destination. Upgrading OLake Go alone does not convert a column that already lands as double.
  • A destination decimal holds at most 38 digits, because Iceberg and Spark hold no wider decimal. A scale of 0 still maps to a decimal, so NUMERIC(10) becomes decimal(10,0).
  • Columns that land as double keep about 17 significant digits, so wider values round.
  • If a double column is part of the primary key, keys that differ only past about 17 significant digits get the same _olake_id and replace each other in upsert mode.
  • Decimal columns keep every digit when used as a cursor field, in a data filter or in the primary key's _olake_id.
NaN and timezone handling
  • A numeric column can hold NaN, which a decimal column cannot. OLake Go writes it as null and logs one warning for the sync.
  • OLake Go always ingests timestamp data in UTC format, independent of the source timezone.

Date and Time Handling​

During transfer, values in date, time, and timestamp columns are modified to ensure valid calendar ranges and destination compatibility.

  • Case I (Year 0000):
    Source dates with year 0000 are not valid in most destinations, so we change them to the epoch start date.
    Example: 0000-05-10 → 1970-01-01
  • Case II (Year > 9999):
    Extremely large years are capped at 9999. The month and date are not affected.
    Examples: 10000-03-12 → 9999-03-12
  • Case III (Invalid month/day):
    When the month or day exceeds valid ranges (i.e. month > 12 or day > 31), or the combined date is invalid, the value is replaced with the epoch start date.
    Examples: 2024-13-15 → 1970-01-01, 2023-04-31 → 1970-01-01
Note

These rules apply to date, time, and timestamp columns during transfer.


Troubleshooting​

1. No encryption (SQLSTATE 28000)​

logs
FATAL failed to ping database: failed to connect to `host=product-team-testing.postgres.database.azure.com user=product_team database=postgres`: server error (FATAL: no p
g_hba.conf entry for host "4.240.65.100", user "product_team", database "postgres", no encryption (SQLSTATE 28000))

Solution: Change the ssl.mode: disable to ssl.mode: allow to resolve this issue. This is a known issue with Azure Postgres and the solution is to set the ssl.mode to allow in the connection string.

2. Connecting to Supabase​

OLake Go can connect seamlessly to Supabase Postgres databases using any of the three connection modes that Supabase provides:

  • Direct Connection – Connects directly to the Postgres instance.
    Note: By default, Supabase's direct connection supports only IPv6. IPv4 support can be enabled via the paid IPv4 add-on.

  • Transaction Pooler – Uses PgBouncer in transaction pooling mode. Suitable for most use cases that do not require session-level features.

  • Session Pooler – Recommended when the client network supports only IPv4. In this mode, each client gets a dedicated database session.

Supabase CDC Support

The Direct Connection mode is required for CDC (Change Data Capture) operations, as Supabase permits replication slot creation only when connecting directly to the Postgres instance.

IP Version Compatibility​

OLake Go fully supports both IPv4 and IPv6 connections. However, Supabase’s IP compatibility depends on the connection mode and account configuration.

To check your machine or cloud environment’s IP version, you can run:

bash
curl -6 https://ifconfig.co/ip

The format of the returned address indicates the IP version:

  • Addresses with four decimal numbers (0–255) separated by dots (.), for example 192.168.1.1, indicate IPv4.
  • Addresses containing hexadecimal segments separated by colons (:), such as 2404:6800:4007:821::200e, indicate IPv6.

Docker IPv6 Support​

By default, Docker containers support only IPv4, which may block access to Supabase’s Direct Connection if IPv6 is required. IPv6 can be enabled as follows:

  1. Open the Docker Desktop Dashboard.
  2. Click the Settings icon (⚙️) in the top-right corner.
  3. Select Docker Engine from the left-hand sidebar.
  4. In the JSON configuration editor, add the following line
json
"ipv6":true
  1. Click Apply & Restart to save the changes and restart Docker.

RLS (Row-Level Security) Considerations​

When using a read-only database role for syncing with OLake Go, ensure that Row-Level Security (RLS) is either disabled or properly configured. If RLS policies restrict access, sync operations may complete without error but result in zero rows being replicated.

To allow a specific role to bypass RLS entirely, execute the following command (replace <rolename> with the actual role name):

sql
ALTER USER <rolename> WITH BYPASSRLS;

3. Failed with non retryable error: LSN not updated after X mins​

logs
Failed with non retryable error: LSN not updated after `X` mins

This issue occurs when wal_sender_timeout is set too low (for example, 30s). If CDC processing takes longer than that, PostgreSQL closes the replication connection before LSN acknowledgment is completed.

It is more likely to happen on databases with concurrent writes or heavier CDC load.

Solution: Set wal_sender_timeout to 0 (recommended) or a sufficiently large value.

4. Delete Records Only Retain the Primary Key​

By default, WAL only includes the primary key on deletes. In OLake Go, delete records (_op_type = 'd') will therefore only retain the primary key and OLake Go metadata columns and other columns appear blank or null.

Solution: To retain the full row values for deleted records, run the following on the affected table:

sql
ALTER TABLE <table_name> REPLICA IDENTITY FULL;

5. TOAST Columns Show __olake_unavailable_value__ After an Update​

When an UPDATE changes other columns but not a large (TOAST) column, Postgres doesn't send the TOAST column's value. OLake Go writes __olake_unavailable_value__ for it.

Solution: Use either of these:

  • Turn on Preserve TOAST Values when creating the source.
  • Run the following on the affected table. Postgres then sends the full row, at the cost of more WAL:
sql
ALTER TABLE <table_name> REPLICA IDENTITY FULL;

If the issue is not listed here, post the query on Slack to get it resolved within a few hours.

Changelog​

Date of ReleaseVersionDescription
27 August 20250.1.11override default timeout in Discover