PostgreSQL (Native)

Version 25.3.9414


PostgreSQL (Native)


CData Sync アプリケーションからPostgreSQL コネクタを使用して、PostgreSQL からデータを取得してサポートされている任意の同期先に移動できます。これを行うには、コネクタを追加し、コネクタへの認証を行い、接続を完了する必要があります。

Note: This connection can be used only as a source for the Enhanced Change Data Capture job type.

Prerequisites

Before you add and set up the PostgreSQL source connector, you need to set up PostgreSQL for enhanced change data capture (CDC), as explained in the following sections.

Minimum Requirements

Before you set up PostgreSQL for enhanced CDC, ensure that you have the following minimum requirements:

  • PostgreSQL Version: Version 12 or later

    Note: Only databases with the UTF-8 character encoding are supported for the enhanced CDC. Strings that contain extended ASCII characters might not be processed correctly during the incremental replication.

  • User Privileges: LOGIN and REPLICATION (the minimum privileges that are required for connecting to PostgreSQL and reading the replication slot)

Set Up PostgreSQL for Enhanced CDC

Perform the following steps to enable logical replication, specify which tables to replicate, and create a logical replication slot for Sync.

  1. Ensure that the wal_level parameter is set in your PostgreSQL database, as follows:

    1. Verify the current wal_level setting in PostgreSQL by submitting the following query:

      SHOW wal_level;
      
    2. Set the wal_level parameter to enable logical replication in either of the following ways:

      Method 1: Execute the following command:

      ALTER SYSTEM SET wal_level = logical;

      Method 2: Set wal_level = logical manually in your PostgreSQL file, as shown below:

        # REPLICATION
        wal_level = logical   
      

    Note: Regardless of which method you use, you must restart the PostgreSQL database for the changes to take effect.

  2. Create a publication to specify which tables to replicate.

    CREATE PUBLICATION cdatasync_pub1 FOR TABLE table1, table2, ...;
    

    You can also create a publication for all tables in the database, as shown below.

    CREATE PUBLICATION cdatasync_pub1 FOR ALL TABLES;
    

    Note: SUPERUSER privileges are required when you create a publication for all tables.

  3. Create a logical replication slot for Sync by submitting the following SELECT statement:

    SELECT pg_create_logical_replication_slot('SlotName', 'pgoutput');
    

    Note: When you create the logical replication slot, you must use the pgoutput plugin.

PostgreSQL コネクタを追加

Sync でPostgreSQL のデータを使用できるようにするには、まず以下の手順でコネクタを追加する必要があります。

  1. Sync のダッシュボードから接続ページを開きます。

  2. 接続を追加をクリックしてコネクタを選択ページを開きます。

  3. データソースタブをクリックしてPostgreSQL (Native) 行に移動します。

  4. 行末にある接続を設定アイコンをクリックして、新しい接続ページを開きます。接続を設定アイコンが利用できない場合は、コネクタをダウンロードアイコンをクリックしてPostgreSQL (Native) コネクタをインストールします。新規コネクタのインストールについて詳しくは、接続を参照してください。

PostgreSQL への認証

コネクタを追加したら、必須プロパティを設定する必要があります。

  • Connection Name - Enter a connection name of your choice.

  • Host - Enter the host name or IP of the server that hosts the PostgreSQL database. The default server value is localhost.

  • Port - Enter the port number of the server that hosts the PostgreSQL database. The default port value is 5432.

  • Database - Enter the name of the database that to which you want to connect when you connect to the PostgreSQL server. The default database is postgres.

  • User - Enter the username that you use to authenticate to your PostgreSQL account.

  • Password - Enter the password that you use to authenticate to your PostgreSQL account.

Complete Your Connection

To complete your connection:

  1. 高度な設定タブで接続の高度な設定を定義します。(ただし、ほとんどの場合これらの設定は必要ありません。)

  2. 作成およびテストをクリックして接続を作成します。