Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vucWN-00GBMD-0z for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Feb 2026 20:27:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vucWM-00F9Cm-0r for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Feb 2026 20:27:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vucWL-00F9Cd-34 for pgsql-bugs@lists.postgresql.org; Mon, 23 Feb 2026 20:27:10 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vucWI-00000000vEP-2q0s for pgsql-bugs@lists.postgresql.org; Mon, 23 Feb 2026 20:27:09 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id DADC71D0002A; Mon, 23 Feb 2026 15:23:26 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Mon, 23 Feb 2026 15:23:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm2; t=1771878206; x= 1771964606; bh=aKfce3H0icqNL/0z0fxFedGQO9epLEtbwfVdJ2rI5KA=; b=M 1QxkRYH6DORIq41Jdj5CLDr9xqsdV4BoyDmA7siAn+TJnYOaCx65zfdacpGUXQEm DxYum2nSaabvzG1x4MGKz0SHvJC9aCtnucRuwlKeYZziHTxC+sH8KvdWwFsflAyb 7dVUmckOMQhWtdCPj0aWiqec4rfOptfhfXeC87u+iYXK6TgR2DkYD6hE/VWbQg5Q ps5CYxOYoyF0jt5SLYp62IA9dZtSdyDtWw7mUCjbZe0auq8xQDG4+2sR4y8XKcJJ s7lfUzPhBUgrs5D42Zqok3pMNIQV6KEmzR1XnLkbDOH3p01rcsRDGPdkN99uD+yb TbbpHAmiMtJRLgs69mWsA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1771878206; x=1771964606; bh=aKfce3H0icqNL /0z0fxFedGQO9epLEtbwfVdJ2rI5KA=; b=U4na7XCARiApT5P480tEA9ydd6nTG bi7FenyyC9WbPjwUbJ28aXa5HPpMWn5AdMuOpoRSRtvrE95M+r9rf9C6pySq8306 Sqz+srSRH8jgZhYvXlllhOeq6Z4aMLixqS+RrwBvGKIHrktWB5HSbp7tYGO6n99R vmkq+HcrHJzkIPk69z811QYY9+qr0C9/Se3GRO61L4s0h8km8XEoj9/U5tGG4sLy +MVP6t9N2fTu1lmZtj/I9YQbuYbxRcSQhOssOZlvSYx/4EPE6H16RplhTjjVrN51 VMNM3yPN6dG4RH1Rzs33gL5SgZxVLwf4p4HvrKGHvcFEVxp3sVvSLsWiw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvfeekudelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtugfgjgesthekredttd dtjeenucfhrhhomheplmhlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehk uhhrihhlvghmuhdruggvqeenucggtffrrghtthgvrhhnpeehgfethefhhffghffhjeegud dujeekieevleehgfefueekhefhuddvledtieevleenucffohhmrghinhepvghnthgvrhhp rhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvpdhnsggprhgtphht thhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjohhsvgdrmhhorhgtih hllhhordhvrghlvghntghirghnohesghhmrghilhdrtghomhdprhgtphhtthhopehpghhs qhhlqdgsuhhgsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Feb 2026 15:23:26 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1771878205; bh=JYG/XRy4oLkOti7iazKXerYYgc+VunkxvRZapw8kzv8=; h=Date:From:To:Subject:In-Reply-To:From; b=zdIeaOnCsrt/iY0tfgJjKrHeK4U9Mk1vxX5Yxb7r/klf42TErMPq8e8cun2iMBez0 OFWDeIUj/oSrSYnplMpl4UMiwgjZofg2J/bPjCCoy+RLtq0fQYvW/Vc5xYi928X0M7 7x/z0AlG4zGI1ejynuP0DqdX7gkRHepdUOrwhuuq5StKH9XzjFlkfkdTpKLAjVVlrN dANrLgfKWmbKAzAGGOIgN9LKsjVM6J/FU5VTssKs/28XDDsNr6AIFxQX5I45dZpbX4 R05LXKyw+/0uKTHtvBsdQMF4D2KK+wkeVhq0jRrpbfQmRo7ySNtJuDB/O9THo3MNwH JBBjxWOIxEDlQ== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 42F4478; Mon, 23 Feb 2026 21:23:25 +0100 (CET) Date: Mon, 23 Feb 2026 21:23:25 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: jose.morcillo.valenciano@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19414: Wrong rows returned by index scan on HASH-partitioned table with PRIMARY KEY (PostgreSQL 16.9) Message-ID: <202602232020.e2fyql4ip6hd@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <19414-add8251d7863a802@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Feb-19, PG Bug reporting form wrote: > CREATE TABLE r_has_stock ( > site_public_id varchar(10) NOT NULL, [...] > ) PARTITION BY HASH (site_public_id); [...] > Additional notes > • Database collation: en_US.UTF-8 > • Server encoding: UTF8 > • Explicit casts and COLLATE tests did not change behaviour. > • Issue appears only when index scan is used. > • Table and indexes originate from a cluster initially running > PostgreSQL 14.12 and later upgraded to 16.9. > • After reindex the issue was resolved. > > > Question > > Could this be related to HASH partitioning combined with PRIMARY KEY / > UNIQUE indexes, or to data created in older PostgreSQL versions and later > upgraded? I would be pretty certain that the problem is related to collation changes, since the partition key is varchar and you said the problem disappeared after the reindex. The solution is exactly that: reindex any indexes potentially affected by collation changes as part of a platform upgrade. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "No hay hombre que no aspire a la plenitud, es decir, la suma de experiencias de que un hombre es capaz"