pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <shammat@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Logical replication from 11.x to 12.x and "unique key violations"
Date: Wed, 22 Jul 2020 13:10:44 +0200
Message-ID: <33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net> (raw)
In-Reply-To: <cfb19a91-e878-6994-4fda-3c64631f72e6@gmx.net>
References: <cfb19a91-e878-6994-4fda-3c64631f72e6@gmx.net>

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






view thread (17+ messages)  latest in thread

Message-ID: <33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net>
Permalink:  ../33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net/
Also on:    postgresql.org/message-id/33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: shammat@gmx.net
  Subject: Re: Logical replication from 11.x to 12.x and "unique key violations"
  In-Reply-To: <33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net>
  References: <cfb19a91-e878-6994-4fda-3c64631f72e6@gmx.net> <33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox