Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r2vu3-001RmZ-0d for pgsql-admin@arkaria.postgresql.org; Tue, 14 Nov 2023 16:04:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r2vu1-008lQb-Eu for pgsql-admin@arkaria.postgresql.org; Tue, 14 Nov 2023 16:04:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r2vu1-008lQT-3y for pgsql-admin@lists.postgresql.org; Tue, 14 Nov 2023 16:04:37 +0000 Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r2vtu-006Pet-Rz for pgsql-admin@lists.postgresql.org; Tue, 14 Nov 2023 16:04:36 +0000 Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-5a84204e7aeso67435557b3.0 for ; Tue, 14 Nov 2023 08:04:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699977869; x=1700582669; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=gxWuf6nk8O3neMU4qUGch0VZhQvy1h1FhaZD8R8wwWY=; b=kWK/aGr5Hr1lYiO4FcU9IqWns3bEs9xSOGfFI/TXwTGcSKtoYB6rE7gFQSFUjvSWoy yEMbHc5Ts7QXNmA2fC4YNhLoyAg9/UAT0e77sptVkHtUDbcHKlJE20FBnzIPfd9aVYXM lzrDcJbqSP3OiNr8AbxkGCb+LR+BIpyxqCBzLzg2D5YFh7SIckSeCWfUgHs2ZIBJm5/v fT5eT5tSAud7HysOPeiWGW8gT0un40UDcVJ7WyZBMq6u2h8g4n61OtBwVov/T5aHR1gY cO9ncCq/zcnpWbb+1nczg6nb19W2utCXBlQzqTLfh3hi6e9CyAUPOwQm9hqaICK9i7aI 1LfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699977869; x=1700582669; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gxWuf6nk8O3neMU4qUGch0VZhQvy1h1FhaZD8R8wwWY=; b=KPNhATywqNAfW+vKhspX0IM2dFnKrnOBSbmtGpJE/8awxOnisr578PExEyHxo9riXq PlC/iahpBZv3buwpEWxFaQDAu+2hWNiEbQBSCCtzerC4zqLUORurM95ch2Pf9lAZA5mk X61yWsoAUvj5WIPmat/nKt6DM1prbmZOiZ/RRVLPI+QMLf7GZJ4qcusiLrZ8K9UDzH9d AkoYCFANFMA6NAi47BTA8z91jGcvLj02n+plwpAhPwg4FUW8b39Im62PtIdSl5D7Ip/G DcbC7ustugq1YoltrVleRTQ//B7N32IpTl6ElEcOoYkpw1C0o3mv/Bs+9MRFOfqRNjCL 4gfg== X-Gm-Message-State: AOJu0YyBX1hzqZvk7hnnzkLpA8J9p7c50hMfs5JWKK5u1Kw8qXMDNAh7 aI0ypl5jukieOUj4A4Qbz5bmmG8jYu8= X-Google-Smtp-Source: AGHT+IF1T9ysPX27R7jsLKtFasvmP3jAi21yh5b3Zdw9jX2YQgc++n5TBxH8fhpeSFRcj2Rs973Q7w== X-Received: by 2002:a0d:f201:0:b0:59f:4bc3:3e9 with SMTP id b1-20020a0df201000000b0059f4bc303e9mr9930380ywf.46.1699977868817; Tue, 14 Nov 2023 08:04:28 -0800 (PST) Received: from ?IPV6:2600:1700:bd2c:b810::44? ([2600:1700:bd2c:b810::44]) by smtp.googlemail.com with ESMTPSA id o195-20020a0dcccc000000b005a23fc389d8sm2426857ywd.103.2023.11.14.08.04.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Nov 2023 08:04:28 -0800 (PST) Message-ID: <401c360a-ff4c-4904-8608-22b24b2179d6@gmail.com> Date: Tue, 14 Nov 2023 10:04:28 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Dupe Key Violations in Logical Replication with PKs in Place Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: From: Ron In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/14/23 09:44, Don Seiler wrote: > Good morning, > > I'm in the midst of a logical replication migration, using PG native > logical replication from PG 12 on Ubuntu 18.04 to PG 15 on Ubuntu 22.04. > All PG packages are from the PGDG apt repo. > > Things had been going smoothly for the most part over the past week, > however in the past 24 hours I've had the subscribers error out (I have > disable-on-error set) on 3 separate tables for duplicate key violations on > INSERT statements. In all 3 cases, the table in question has a valid PK on > both the publication and subscription sides. > > The record in question exists on both sides and is identical. In all 3 > cases, I delete the row on the subscriber and re-enable the subscriptions. > The INSERT proceeds and inserts an identical row to the one that I just > deleted and everything proceeds happily. > > I'm very confused, however, as to how this scenario is possible if I have > a PK enforced on both sides, although I believe that the publication side > PK alone should have prevented this. What data type(s) in those columns, and what locale on each server? Maybe the change from 18.04/12 to 22.04/15 has caused some weirdness with "foreign" characters. -- Born in Arizona, moved to Babylonia.