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 1jyCeE-0000Qq-TO for pgsql-general@arkaria.postgresql.org; Wed, 22 Jul 2020 11:10:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jyCeD-0003L3-K4 for pgsql-general@arkaria.postgresql.org; Wed, 22 Jul 2020 11:10:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyCeD-0003Kv-A6 for pgsql-general@lists.postgresql.org; Wed, 22 Jul 2020 11:10:53 +0000 Received: from mout.gmx.net ([212.227.17.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyCe9-0002xr-7v for pgsql-general@lists.postgresql.org; Wed, 22 Jul 2020 11:10:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1595416245; bh=cZovXSyySoAzv/XIag045VIz9iDiprK5mimS5by/0gk=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=FFJbGY5Qlvq/qWfU5lkY7PUR6neZVysiwdURZewbHUb4merARTZkdlqMLqbYInX7m zyAMj/QTG06npTmKBgyoYscTT63ZhHWqp1WzZr3qS6uVuUzpUmQ6NGOx4vPYkZigFP Xf9C+3ZZYkfPY0cRNXwBfvs+BFe59hAHtVfuWPi8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [10.1.35.134] ([185.40.248.10]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MwfWU-1kj7zr14Ju-00yABG for ; Wed, 22 Jul 2020 13:10:45 +0200 Subject: Re: Logical replication from 11.x to 12.x and "unique key violations" To: pgsql-general@lists.postgresql.org References: From: Thomas Kellerer Message-ID: <33f03eeb-1904-1f7e-a5d7-5d4c36a652d6@gmx.net> Date: Wed, 22 Jul 2020 13:10:44 +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 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:SpF+QqIwageLRA4PER495Ivbhey7ekMITrUdnpq8mif8sOxHYGl T/35svnYHkzBC29lREdBYS6gpbVwX63p6qxDs+4Wkv8vKceb4tPP4JA3qYmCcc2ks6/GPgu Ded54QOUfVBKOPrvQNY5lGFlc7D5S4uUmLNTTb1E0S2q6aTjA6HnDCESwSxowjMvQSaGowk IcTT/xXcQ84L59f/aSzAg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:1wSZM58tnlA=:lrTrU/uFUyoWTb4pqyG7h3 vvaEw8+tVx02iZcycevhhW16DzKfYtHDgMT7iEyTjWyD7JNE+pfzBE9w7zjAgyj6oPqKhZO7n 3XmJE6puJaLEDpwnnhSO5w2mbfaobzYKLRUPahNhL0o/V2nrT4JuKYkaFW/jndTvmcyR7VkFT oTQPm3j8c32cj47XHP0DSzPrxabrowGUafyACG1ViOZjGpEy0LkOVMIKkjOOMkyjxTUKr79Gh CeeWKe9A2HgUbTHJ2LeMANfOiwI7W9BiivnrW+W+WLLoazk8BWcrB/CwkItfOI2tj3S2MpGiw U9NmzixrziC4r7LqFjwQdx5t5kSakwiuPv2LB0wwLUmyzPlekGTI9Q+g48DcrKBSCea3VZ6kW TmavhFUr4aC6AtmslEQKPkMoEL8vkReqwN82OcYJCIUbZ+lNr7EKJxPLE6dHS6T7eJW+Q9wZu K7rxESDchRjVKCUsf0e/+YfkHQuoMXkqaBK3AahIxD5HfjIV5llVNEive0ynZcCVNPWKd/5NJ 72C7/rZUfQSkhvBOeZ9PaMgSJ/hSQTLYOYDJbB3GFoGySXZPYRxRsCzcmDzhGUR3Czr1HLmuS Sl9BNjwFMwmQVE63B5JH+9i7eckENvLkU+ncCEhkNohp5O+olBoq0Fbs21ON/1oIMob+WNgnc p5w9gf60/tG8rZGiYvw3Ye092hwtOo+oLNE61LEkq0xQq3ErHwEQ0+bQEltoHTmzjS33in10v 0vghpnirLda37aZ4A1wuR1AwssWmkjColglgo8AZ/YEdHHDn9fVeacT8AuSihbmhluu0PmcQY KbCNJmB4dQAAX0bG4A7EjJ51xqfIxFKiYaAn4zmiE2tVoR0Ys2fkqLt5DtXYvA9ZKS0gEwY14 gVDdhc0CTQZdZEmfTTMSY/JxPP2o7vps+ByYhBNR5nM09gqRByomDJoURNFfLoBk6zDGNU423 M9rLQbgGNagA37E7o2yejb9jH428/mEjZ+GDzkRmgG3jbbQHmZH1dpOpF5EvQZrltnuUkHDT3 NXGvHxQvt/VUS16D+mhACJqb2/4lSZ3DDwaYufLzWUZBk/QYMjcquEObj9EbbcE2HFBVWkzI4 Z6iuj8EnmO1F8LqY3P7HHdIRGsX6NRyoQVEzTyUXqRc2nnLswsa//2+wzpoXhdCjYdy+vnlN2 TwkC7TchWNOHKLYwpsuRrMkU8TcUGwfGL90lEYcWmqQ7vbTXsroYRTFerN/YNJbHLAmQnF7xy l718ONlsAV5/Bi4N5 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 chai= r. The script/job to initialize the database structure (to make sure primary = and secondary are in sync) also includes statements to setup the lookup ta= bles. So obviously the initial sync would fail for those tables. When I re= -started replication I truncated all tables without re-running the setup s= cript. 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