Renaming a PostgreSQL Table Triggers a Re-Sync When Using WAL Logical Replication
Issue
When you rename a table in your PostgreSQL source while using WAL logical replication, Fivetran treats the renamed table as a new table. This triggers a full re-sync.
Environment
- Connector: PostgreSQL
- Incremental sync method: Logical replication with replication slots
Resolution
To resolve this issue:
- Before renaming the table, add both the original and renamed table names to your PostgreSQL publication. If the renamed table isn't in the publication when you rename it, Fivetran can't capture its incremental WAL changes.
- Rename the table in your source database using
ALTER TABLE. - If you need to preserve the existing destination records, back them up before proceeding. Fivetran truncates the destination table during the re-sync.
- In Fivetran, go to the Schema tab and re-sync the renamed table. For instructions, see How to Trigger Historical Re-Syncs.
- After the re-sync completes, Fivetran resumes incremental syncing using WAL.
For more information on how Fivetran handles DDL changes, see Support for DDL changes.
Cause
Fivetran tracks PostgreSQL tables by their schema-qualified names. When you rename a table, we detect the renamed table as a new table rather than the existing table under a new name. As a result, we require a full re-sync to create the renamed table in the destination and resume incremental replication.