Re: Logical replication from 11.x to 12.x and "unique key violations" - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: Logical replication from 11.x to 12.x and "unique key violations"
Date
Msg-id 33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net
Whole thread Raw
In response to Logical replication from 11.x to 12.x and "unique key violations"  (Thomas Kellerer <shammat@gmx.net>)
List pgsql-general
Thomas Kellerer schrieb am 13.07.2020 um 11:52:
> If I create the publication with all needed tables (about 50) at
> once, I get "duplicate key value violates unique constraint xxx_pkey"
> errors during the initial replication (when creating the
> subscription).

Turns out the problem was - once again - between the keyboard and the chair.

The script/job to initialize the database structure (to make sure primary and secondary are in sync) also includes
statementsto setup the lookup tables. So obviously the initial sync would fail for those tables. When I re-started
replicationI truncated all tables without re-running the setup script. 

I wonder if it makes sense to add an "on conflict (pk) do nothing" option to the logical replication features ;)

Sorry for the noise
Thomas




pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: How to create function returning numeric from string containing percent character
Next
From: "Daniel Verite"
Date:
Subject: Re: Switching Primary Keys to BigInt