Re: Logical replication from 11.x to 12.x and "unique key violations"

From: Thomas Kellerer <shammat(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Logical replication from 11.x to 12.x and "unique key violations"
Date: 2020-07-22 11:10:44
Message-ID: 33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 statements to setup the lookup tables. So obviously the initial sync would fail for those tables. When I re-started replication I 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2020-07-22 13:27:08 Re: Switching Primary Keys to BigInt
Previous Message Andrus 2020-07-22 10:49:53 How to create function returning numeric from string containing percent character