Skip to content

PostgreSQL

PostgreSQL as a source

Setting it up: PostgreSQL.

  • The agent fails when it creates its slot, saying logical decoding requires wal_level logical: see Turn on logical replication.
  • "Replication slot 'name' exist. But is of incorrect type": a slot of that name exists with another plug-in. Choose another control schema, or set pgSlot (see Settings).
  • A second agent on the same instance can't create its replication slot: slot names must be unique in the instance, and the slot is named after the control schema. See Replication slot and WAL.
  • "Unable to ALTER TABLE for REPLICA IDENTITY" in the agent's diagnostics when you subscribe to a table: the agent user doesn't own the table. See Create the agent user.
  • "Last read position=... New position=...": the slot no longer holds the agent's position, for example because it was dropped and created again. The tables need new baselines (see New baseline needed).
  • Columns replicated empty after updates: see Tables (REPLICA IDENTITY FULL).
  • "Stored procedure SQDR.ADDSUBSCRIPTION returned error 11 ... SQLCODE=-670, SQLSTATE=54010" when you add a subscription for a table with very many text or bytea columns (around 100): the staging table for it would be larger than the Db2 row size limit of the staging database (SQL0670N). This is rare; contact Stelo Support.
  • "Request Failed 500 Server Error" when the wizard connects: see the Jetty wrapper log, as in SSL/TLS.

The source server's disk fills with WAL

Disk use on the PostgreSQL source keeps growing, in the WAL folder (pg_wal).

Cause: a replication slot that nothing reads any more, usually one left by a deleted agent, or one whose agent is stopped or far behind. A slot keeps all the WAL from its position on (see Replication slot and WAL).

What to do: list the slots, with the WAL each one holds, for example with psql -h localhost -U postgres:

SELECT pg_size_pretty(pg_current_wal_lsn() - restart_lsn) AS lag, slot_name, wal_status, active
  FROM pg_replication_slots
 ORDER BY 1 DESC;
   lag     | slot_name  | wal_status | active
-----------+------------+------------+--------
 6621 MB   | old_slot   | extended   | f
 296 bytes | sqdr       | reserved   | t

Here old_slot isn't active and holds 6.6 GB. If no agent or other application uses it, drop it:

SELECT pg_drop_replication_slot('old_slot');

PostgreSQL then removes the WAL files it no longer needs, and disk use drops. Don't drop the slot of an agent you still use: the agent then loses its position, and its subscriptions need new baselines. For an agent that's only stopped, start it so that it catches up.

See also:

For any other message, see Error messages.

PostgreSQL as a destination

Setting it up: PostgreSQL.

"invalid byte sequence for encoding "UTF8": 0x00"

Inserting rows fails with a message such as:

Insert failed at destination. [PostgreSQL]ERROR: invalid byte sequence for encoding "UTF8": 0x00

Cause: a source character column contains a NUL byte (x'00'), which PostgreSQL doesn't accept in text. Seen, for example, in CHAR columns of Db2 for i tables.

What to do: replace the column in the subscription with a derived column that turns the NUL bytes into blanks, with the same name and type:

  1. On the subscription's Columns tab, delete the column.
  2. Click Insert Derived Column, enter the column's name and type, and the expression, for example for a Db2 source:

    TRANSLATE(MYCOL, ' ', x'00')
    

    The syntax of TRANSLATE and of hexadecimal literals differs between databases: write it for the database that computes the expression (see Rules for expressions).

During baselines and snapshots, the remediateNulls service property (on by default) already cuts a VARCHAR value at its first NUL byte; it doesn't apply to CHAR columns or to incremental changes.

The destination server runs out of memory during baselines (EDB Postgres)

During baselines of large tables to an EDB Postgres Advanced Server destination, the memory used by the postgres process on the destination keeps growing until the process stops.

Cause: EDB auditing was on at the destination.

What to do: turn off auditing on the destination, with edb_audit = 'none' in postgresql.conf (see EDB's documentation for when the change takes effect). This setting exists only in EDB Postgres.

Other problems

See also: