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 1lHr3d-0008Fb-1s for pgsql-general@arkaria.postgresql.org; Thu, 04 Mar 2021 16:42:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lHr3b-00071d-UL for pgsql-general@arkaria.postgresql.org; Thu, 04 Mar 2021 16:42:35 +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 1lHr3a-000719-JN for pgsql-general@lists.postgresql.org; Thu, 04 Mar 2021 16:42:35 +0000 Received: from [66.111.4.25] (helo=out1-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHr3W-0006r2-R8 for pgsql-general@postgresql.org; Thu, 04 Mar 2021 16:42:34 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id DF3115C0094; Thu, 4 Mar 2021 11:42:18 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 04 Mar 2021 11:42:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=C DUkitfBYZWmBeXL00uF7RZ1aJI6rQPBXp/nMLRgWEw=; b=cDdcV9lVI0lJpeQpM fHJfIsQSEjmAka+0X1BnNH7rjCtIp+l/lLMFBNw4cK6rS8YCONpurdbbbZT2guua IN/BNYSCyItuN/2gZNbkUc4QRycSw4aSCcAt0WF4sAtR/QA4To8UIWes6gNzrVhJ D5TioQ7FEP8hhoHD8pixVcSeq3rjHaihW/1R9LgjltljwY4ZB5Lb6jzmU3fDnH3N lyOlqF2l58+sRuY4RdA7ZxjbEiXwqKC0xBZBGhocso5Y/kWUpT8LzEUlGDGzbNy0 E5wCd+iKGXTNKZqS/O1tsbTLUYokqQfFcnlR6ngkNpUdqTJx3vbRN/KUm8pQUhd3 cGMQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=CDUkitfBYZWmBeXL00uF7RZ1aJI6rQPBXp/nMLRgW Ew=; b=YNh4j/Z7Nbye5+AU5L3pxCxcSXsNWnuBdLDxQ+6PknWlgRTfK8Y4Fl3mb IDqx+fZRSKA37JVu0PCq6F1Lq2/0IsPAnyAs8PsjL9eX7HUUod3RDHym0DwCssV2 EW7kpTHt/s69h/bGwMXuoiRWK/zMOPs1+PTekczSkMDkhH5x5XpKhJhiWerK22vY nzUJopelznIpoO0Yv4CnsqG7QjqK84Dpe0QaZ5hTk6NiIlG6yStdBbQlic7ao7ZQ fuLYy1ybnJaKL0wAaaDnz1/Yiu6EULj0K+ZnukXPEjPqiTPwkO0ptBRhp8Fkp52F 55FweVPdr7QXygmfbqNoCkdOZNsYw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddtgedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepteejvdetff ejuedvleeifeefheeutdfhgfdvhffhhfekvdduveegvdejudefgfevnecukfhppeeljedr uddufedrvddujedrvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.4] (97-113-217-27.tukw.qwest.net [97.113.217.27]) by mail.messagingengine.com (Postfix) with ESMTPA id D378A24005B; Thu, 4 Mar 2021 11:42:16 -0500 (EST) Subject: Re: Duplicate key error To: Andrus , pgsql-general@postgresql.org References: <5b68b4b3-b957-5009-cf3e-4bbc9dcbd0d9@aklaver.com> <97577cda-b3fa-4edb-1c8a-2b39afad65c6@hot.ee> <6a9dcf88-7b28-3b8f-0a1a-8a163f45a2a8@hot.ee> From: Adrian Klaver Message-ID: <6cdec299-a677-03c4-2c8e-36560e052c9e@aklaver.com> Date: Thu, 4 Mar 2021 08:42:16 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <6a9dcf88-7b28-3b8f-0a1a-8a163f45a2a8@hot.ee> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/3/21 10:14 PM, Andrus wrote: > Hi! >> says something else is inserting/updating using that key value. So >> obviously your script is not catching all the conflicts. > > > At this point your best bet is to monitor the Postgres log and see > what else is happening at the time of the error. I'm guessing you will > find another process working on that table. > > It looks like other process has added same row during trancaction. > > How to change script so that it works starting at Postgres 9.0 and does > not cause error in this case ? Since we have not actually seen the entire script nor have any idea what the other process is, there is no way to answer this. > > Andrus. > -- Adrian Klaver adrian.klaver@aklaver.com