Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1juv8u-0001mt-E2 for pgsql-general@arkaria.postgresql.org; Mon, 13 Jul 2020 09:53:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1juv8t-0006wn-Cb for pgsql-general@arkaria.postgresql.org; Mon, 13 Jul 2020 09:52:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1juv8t-0006wg-3I for pgsql-general@lists.postgresql.org; Mon, 13 Jul 2020 09:52:59 +0000 Received: from mout.gmx.net ([212.227.17.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1juv8q-0000H7-8O for pgsql-general@lists.postgresql.org; Mon, 13 Jul 2020 09:52:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1594633974; bh=+xQY5X9sKws1HQeN1aDdea85OByDs6VNSzZN+vwiUyY=; h=X-UI-Sender-Class:To:From:Subject:Date; b=XIVCyPx4rkP7cGiueutt0r7GZ641z1kxmWxSYQCBm9F6Jceq4C6uoBV9B6Um2nikU 3yoVqMaVmY4xSgzb9C6DKxRkXTDCoLPNM2AfqEPPximoD8bQA2nzLJrGkMlV7AHU27 1WVnG12wI1y+JA4uDbvYVKSboMv3hzTBA5rKhozw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [10.1.33.140] ([185.40.248.10]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N4hvb-1kuPJJ057X-011iTJ for ; Mon, 13 Jul 2020 11:52:54 +0200 To: pgsql-general@lists.postgresql.org From: Thomas Kellerer Subject: Logical replication from 11.x to 12.x and "unique key violations" Message-ID: Date: Mon, 13 Jul 2020 11:52:52 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:5M1H8vKymqtOKf788PMKrB23nCuKGvhiks07Tuu3trdHkIHfV0z 3tbb0jR51YD6HfLsYMVw0wMqV/RAC3rPUmHu0kXB8stR0h7AtoIGu/g8VVUByvi/qRllaAN 7MuiOIysY8IlY58Yub7LADARIpXijkVjdN+o+ie0zO4zck2wlX44PlkXSfDvLuTiDj1WrVc 6zZ9sKWIw8ucHvMVJMpCg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:haMRE8dd9A8=:XpphhWR7X/U4eRKXvEdg+j y1yHEMtmw+zvm4mOGzTxuCDbfJ8W+mgv7rn5R52zUwdQhL7oPaghxbuEKon1dU49nXJCBcsGL KbEcM0llD4WUFmd3Ar5wAEKKn0QoT4obWTSOEMLWlsKdJ30asNI9bJMICD8ZIR/FNV87q+llM lzR3dHp3VknNIwEmkfqpkBPBj0jXoUcFTSVpM4qTGMvQUB5aUyxMLXpS2y0X61DQUAQySnyAn kT79pNnQSYp8sC5VVMAi4CTQrE8RtRNcFZ2QG2rH/t6AEPDfU77oaxoYsVksJ0mAZjCmn9BCo NWE/tM11Z8imXHecAJNkh93fALCM/BPpEQ9wrNH4uIF8/aMrUeOdEDs6GLqaPIsr3Bsgbbvn6 LMf7QZh8ux9tmTRljCwzWM5m4JQULnZW8g1/Dah4K9VbPOG2uq9TqqCWTQIglNAt5y7E1J8Ve GZYMDmZgBzdOJQSGQxS2nD2w9Urflpmm6EvL5155Dg4/MYQz/uL+UDZI44yPdL7g3kInFI4F/ LwCjB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4UOlytQ2qbA== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, I have a strange error when using logical replication between a 11.2 (I kn= ow!) source database and a 12.3 target. If I create the publication with all needed tables (about 50) at once, I g= et "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 gen= erated 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 runnin= g 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 o= f tables for the initial replication. I have seen that there were several bugfixes between 11.2 and 11.8 regardi= ng logical replication (including some index related fixes). But I am unsu= re 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