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 1oonjG-0007Ct-IB for pgsql-admin@arkaria.postgresql.org; Sat, 29 Oct 2022 15:26:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oonjF-0000cF-Ep for pgsql-admin@arkaria.postgresql.org; Sat, 29 Oct 2022 15:26:33 +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 1oonjF-0000c6-4S for pgsql-admin@lists.postgresql.org; Sat, 29 Oct 2022 15:26:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oonjC-0001bS-2V for pgsql-admin@lists.postgresql.org; Sat, 29 Oct 2022 15:26:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 29TFQOsU014713; Sat, 29 Oct 2022 11:26:24 -0400 From: Tom Lane To: Samed YILDIRIM cc: Teju Jakkidi vlogs , Holger Jakobs , pgsql-admin Subject: Re: Duplicate data even with primary keys enabled In-reply-to: References: <59B1180A-4A4B-4A1A-B50A-C9D9B41AA67D@gmail.com> <74e777cb-c332-3db7-7c4a-784d408227d6@jakobs.com> Comments: In-reply-to Samed YILDIRIM message dated "Sat, 29 Oct 2022 18:06:14 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14711.1667057184.1@sss.pgh.pa.us> Date: Sat, 29 Oct 2022 11:26:24 -0400 Message-ID: <14712.1667057184@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Samed YILDIRIM writes: > Hi Teja, > Your columns are varchar. They may seem the same to you due to the tool you > use. But, it doesn't mean they are identical. There can be leading or > trailing spaces. Another thing I'm wondering about is index corruption due to an operating-system upgrade that changed string sort ordering. Nothing might be obviously wrong right after the upgrade, but index searches would probably fail to find existing entries, which could lead to not rejecting duplicate entries. This is, sadly, not at all hypothetical or uncommon. There's some info about this hazard at: https://wiki.postgresql.org/wiki/Locale_data_changes regards, tom lane