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 1pL3J6-0000vs-Cc for pgsql-admin@arkaria.postgresql.org; Thu, 26 Jan 2023 14:32:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pL3I7-0000QR-68 for pgsql-admin@arkaria.postgresql.org; Thu, 26 Jan 2023 14:31:51 +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 1pL3I6-0000QG-Oe for pgsql-admin@lists.postgresql.org; Thu, 26 Jan 2023 14:31:50 +0000 Received: from mail.unimaticaspa.it ([89.97.230.136]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pL3I4-0001OA-4x for pgsql-admin@lists.postgresql.org; Thu, 26 Jan 2023 14:31:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=unimaticaspa.it; s=mail; h=Message-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:To:Subject:MIME-Version:Date:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cQ6aLke39pYcIec+kwq75GRklI/kPXrZ+OmoZikAg+8=; t=1674743507; x=1676039507; b=hcJ4QiAueMBBd5LwcF3uPMDXqUPGnOjnzUj7dFLXuz/clnyu7uHDSS7D7CWVZidPPSYiNrjGDxP lbyxnWbZY4ssXkLOcteS6NRGj4lk/s8EeD0oW0nZ7Mi7R6WtVzgiJOGPWQg3AWxHijwkJd2gZA64S Njq0wXDkMFBB+OfUOT4xCTfhNPdbis3BwP0sCU4Tnn4WyHQSy7psMd1PItaT43nNCTdQIz7QWVwIt Pnt7FaJR50XDsvlC1ZyYO3X+9MZOWIAvYik0ixpminRalpfths/oL2NlRPiZnSIq2WgichoXwUHlq aEa5wGR9+uot8ru+u8PhIVY3o/rZAEWuacJ3bKPmhj6B1ZAEnIitdZae5QB4JXBJJJ0AollL6D93X hWyT66rH4mIAnf4FdlAxfYq+p4obzZtFvIEyaZT5IPBi/r/6E2OzUVia4BF2G89VPOHUun4OMJQol Gyy7uJPK3JhuXYWBZtSRx+/ExkPYScN2j7LFNJR9EKP+KuCfjdMnfMhEj7pgLgmSZuQrMp7pxF4rW kHRqYlLNWBRnyaJeTjtCoZPgX9mXqbVJxToNNo8Va1kBBBg1n6zWarcGNKtSOLX26FS64WrSO2bTN GLoXnIMJSQsXUnpSZY454A2FTPDT5qckIY3637nKfs81YV/sBEjUgGgXyLoCeF8/phZaY=; Received: from pc-ortensi-fisso.unimatica.lan ([10.143.90.127]) by mail.unimaticaspa.it with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pL3I2-00D3P1-A2; Thu, 26 Jan 2023 15:31:46 +0100 Date: Thu, 26 Jan 2023 15:31:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Problems with unique constraints To: Erik Wienhold , pgsql-admin@lists.postgresql.org References: <1pKzDp-00CgfG-JH@unimaticaspa.it> <1968679708.705665.1674730579540@office.mailbox.org> <1pL0ni-00CnZb-3m@unimaticaspa.it> <2137860386.717969.1674736784938@office.mailbox.org> From: Massimo Ortensi In-Reply-To: <2137860386.717969.1674736784938@office.mailbox.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Unimatica-LocalUser: true Message-Id: <1pL3I2-00D3P1-A2@unimaticaspa.it> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Confirmed, the local is the same but sorting changed. Thanks Il 26/01/2023 13:39, Erik Wienhold ha scritto: >> 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 checking >> 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 wrote: >>> >>> 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,  where an abnormal poweroff happened 6 months >>> ago, found 3 tables with the problem throughout last 6 months. >>> >>> - a test server, found the problem on 1 table after upgrading version 10 >>> 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