From: Thomas Kellerer <shammat@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Logical replication from 11.x to 12.x and "unique key violations"
Date: Mon, 13 Jul 2020 11:52:52 +0200
Message-ID: <cfb19a91-e878-6994-4fda-3c64631f72e6@gmx.net> (raw)
Hello,
I have a strange error when using logical replication between a 11.2 (I know!) source database and a 12.3 target.
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).
When create the publication only with a few tables, the initial data sync works without problems.
To replicate all tables, I add the tables incrementally to the publication, and refresh the subscription.
If I do it like that (step-by-step) everything works fine. Tables that generated the "duplicate key value" error previously will replicate just fine. The tables are quite small, some of them less then 100 rows.
The table definitions and primary keys are 100% identical between the two systems.
However all tables where this error occurs, have a varchar(100) column as part of the PK definition (don't ask).
The values in the PK columns are 7-bit ASCII only. Both servers are running CentOS 7.x and use UTF-8 as the encoding.
If this was a glibc version issue between the two operating systems, then I would expect the failure to be consistent, not depending on the amount of tables for the initial replication.
I have seen that there were several bugfixes between 11.2 and 11.8 regarding logical replication (including some index related fixes). But I am unsure if they related to 11.2 being the publisher or subscriber
Could this indeed be caused by the outdated 11.2 on the publisher side?
Is there anything else I could check to identify the root cause?
As I can replicate the tables without problems, this isn't a big issue for me right now, but I would like to know what the root cause is.
Thanks
Thomas
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: <cfb19a91-e878-6994-4fda-3c64631f72e6@gmx.net>
References: <cfb19a91-e878-6994-4fda-3c64631f72e6@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