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 1pL96v-0005LS-Gm for pgsql-admin@arkaria.postgresql.org; Thu, 26 Jan 2023 20:44:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pL96u-0003hA-FU for pgsql-admin@arkaria.postgresql.org; Thu, 26 Jan 2023 20:44:40 +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 1pL96u-0003gv-29 for pgsql-admin@lists.postgresql.org; Thu, 26 Jan 2023 20:44:40 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pL96r-0005ye-IW for pgsql-admin@lists.postgresql.org; Thu, 26 Jan 2023 20:44:39 +0000 Received: by mail-wm1-x342.google.com with SMTP id f19-20020a1c6a13000000b003db0ef4dedcso4043578wmc.4 for ; Thu, 26 Jan 2023 12:44:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=fRYLP5uWs7Sb8ebLfqK33c3Tot6np6Xe6lhRJLz2dhk=; b=qlk78JjTUojnkLNIt6Eu2NKGNt20riLnJc8MqmjTZMEU4eYnFBXQYe7YJQWw91dYBY PWIGE2EwVGRTmXQ0vmS/0rbBbgvkc1iKdet+NyQ75zvZS5hJQdZ48wcsHlm3AVRjkTVW vJwh915zoD+Ya6KXwgFe6UbP9kztYR9DBOyhaZtF+BMgCGelKI0AG8iiTHaUGrMiGpU5 IZPlhz3CyI82SYO5R+Cb5+H5MNIRQ46qsT4hNqegrQS6WGHXpSzojGCLjSQy//Ab2rk/ BMHX7FJOQH3g0cGtLiVSqBfppdEToh7bKFtPuH51cK72rcG4DFAuhsWoTXdcy2fy+xbr tJag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=fRYLP5uWs7Sb8ebLfqK33c3Tot6np6Xe6lhRJLz2dhk=; b=eXQSmPf0VrwdcQ14bk4QDRNoTTC3CFuJdSKFigj5p9LeDEDeCJ8wVqfs9DSL8Lxcd+ 81+S+v5WpcjkyYZ5GUiZes3q3+y0IE1pnuUP/2f0iCPlnvjDCsZhTJPoUyGV6q7rsX8J SIEKcbCRsjIvy8ndKeNCzfUYFmBZZikwW77dfb9i6/+Mu16ICoW+7tC9FTCaNIHH7x7L FTo/xYQ3sb6TO2n9v7pyNIalAqULuSYBuWVFr50STMO6nS8iRVRSk84B7o1G9XWJRL8d 7bx0dcQ7DFm9bd/+6fdMirIcI3RCglULlgnCrOZemAuYIsJnEQ6vq/VITx/VysWrovMe doLg== X-Gm-Message-State: AFqh2kpE/cgSj2GKGLYT3GsmihotOq//mzQWH8WmyWvzbBmtLD2JppSe gl4dHZEitkIelgg1zo1Jebk+eodk9/NlPJmQQqQ= X-Google-Smtp-Source: AMrXdXsTIxQ/vO6Zh8EJA1pl5L8EBgzSHsfQrDuZRJZmffPXfpD+FtLMxZfhWAbORjPtwll2TWeg+w== X-Received: by 2002:a05:600c:181b:b0:3da:ff1f:e8d3 with SMTP id n27-20020a05600c181b00b003daff1fe8d3mr36050161wmp.15.1674765875912; Thu, 26 Jan 2023 12:44:35 -0800 (PST) Received: from localhost.localdomain (business-24-134-51-233.pool2.vodafone-ip.de. [24.134.51.233]) by smtp.gmail.com with ESMTPSA id n6-20020a7bcbc6000000b003d237d60318sm2379703wmi.2.2023.01.26.12.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 12:44:35 -0800 (PST) Message-ID: <32372394ccb0bf7458348973475968fa26de076f.camel@cybertec.at> Subject: Re: Problems with unique constraints From: Laurenz Albe To: Massimo Ortensi , pgsql-admin@lists.postgresql.org Date: Thu, 26 Jan 2023 21:44:35 +0100 In-Reply-To: <1pKzDp-00CgfG-JH@unimaticaspa.it> References: <1pKzDp-00CgfG-JH@unimaticaspa.it> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 (3.46.3-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2023-01-26 at 11:11 +0100, Massimo Ortensi wrote: > I had troubles with some unique constraints recently. >=20 > They simply didn't work, not seeing some records (select found only 47= =20 > records with specific values instead of 65, insert could create=20 > duplicate records). >=20 > The constraint were on multiple columns. Drop constraint and create=20 > constraint fixed the problem. >=20 > This happened on two servers : >=20 > - a version 10 server,=C2=A0 where an abnormal poweroff happened 6 months= =20 > ago, found 3 tables with the problem throughout last 6 months. >=20 > - a test server, found the problem on 1 table after upgrading version 10= =20 > to 14 >=20 >=20 > Anythng similar happened to anybody ? Yes, there were quite a number of such reports. > How can I find out if similar problems are present ? constraint and=20 > index looked ok and were used This is almost certainly caused by an update to the library that provides y= our collations. The update must have changed the definition of those collation= s and consequently the sort order, corrupting your collations. These articles describe the problem and ways to a solution: https://postgresql.verite.pro/blog/2018/08/27/glibc-upgrade.html https://www.cybertec-postgresql.com/en/icu-collations-against-glibc-2-28-da= ta-corruption/ Yours, Laurenz Albe