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 1pL1Ym-0002M9-2o for pgsql-admin@arkaria.postgresql.org; Thu, 26 Jan 2023 12:40:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pL1Xm-0007ZU-PY for pgsql-admin@arkaria.postgresql.org; Thu, 26 Jan 2023 12:39:54 +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 1pL1Xm-0007Xh-EP for pgsql-admin@lists.postgresql.org; Thu, 26 Jan 2023 12:39:54 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pL1Xi-0000I7-HB for pgsql-admin@lists.postgresql.org; Thu, 26 Jan 2023 12:39:53 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4P2gJd39k5z9sTW; Thu, 26 Jan 2023 13:39:45 +0100 (CET) Date: Thu, 26 Jan 2023 13:39:44 +0100 (CET) From: Erik Wienhold To: Massimo Ortensi , pgsql-admin@lists.postgresql.org Message-ID: <2137860386.717969.1674736784938@office.mailbox.org> In-Reply-To: <1pL0ni-00CnZb-3m@unimaticaspa.it> References: <1pKzDp-00CgfG-JH@unimaticaspa.it> <1968679708.705665.1674730579540@office.mailbox.org> <1pL0ni-00CnZb-3m@unimaticaspa.it> Subject: Re: Problems with unique constraints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 26/01/2023 12:52 CET Massimo Ortensi wrote: > > we had OS upgrades, but with the same locale. Which OS? Locale may still be the same but collation information may have changed, resulting in a different sort order. https://postgresql.verite.pro/blog/2018/08/27/glibc-upgrade.html Has libc version changed with the OS upgrades? > Is there any chance to avoid rebuilding of all indexes/constraints by che= cking > the correctness of indexes ? Extension amcheck (functions bt_index_check and bt_index_parent_check) can verify that btree entries for text are in lexical order. https://www.postgresql.org/docs/current/amcheck.html > Il 26/01/2023 11:56, Erik Wienhold ha scritto: > > > On 26/01/2023 11:11 CET Massimo Ortensi wrot= e: > > > > I had troubles with some unique constraints recently. > > > > They simply didn't work, not seeing some records (select found only 47 > > records with specific values instead of 65, insert could create > > duplicate records). > > > > The constraint were on multiple columns. Drop constraint and create > > constraint fixed the problem. > > > > This happened on two servers : > > > > - a version 10 server,=C2=A0 where an abnormal poweroff happened 6 mont= hs > > ago, found 3 tables with the problem throughout last 6 months. > > > > - a test server, found the problem on 1 table after upgrading version 1= 0 > > to 14 > > > > Anythng similar happened to anybody ? > > How can I find out if similar problems are present ? constraint and > > index looked ok and were used > > > Are the indexes on string types? Changes to the locale data is one cause= : > https://www.postgresql.org/message-id/328626.1647362495@sss.pgh.pa.us -- Erik