Re: BUG #19414: Wrong rows returned by index scan on HASH-partitioned table with PRIMARY KEY (PostgreSQL 16.9)

From: José Antonio Morcillo Valenciano <jose(dot)morcillo(dot)valenciano(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19414: Wrong rows returned by index scan on HASH-partitioned table with PRIMARY KEY (PostgreSQL 16.9)
Date: 2026-02-24 09:26:45
Message-ID: CA+nR40nyF++Y9v6u6qrSGMmhH9FxzoN_d4NAMXQDtn5KCaqaWA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi!

After upgrading we reindex all our databases, so I don't see it clear.
The difficulty here is finding a test case to work with.

El lun, 23 feb 2026 a las 21:27, Álvaro Herrera (<alvherre(at)kurilemu(dot)de>)
escribió:

> 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"
>
>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Álvaro Herrera 2026-02-24 12:18:00 Re: BUG #19414: Wrong rows returned by index scan on HASH-partitioned table with PRIMARY KEY (PostgreSQL 16.9)
Previous Message Sergei Kornilov 2026-02-24 07:33:07 Re: basic_archive lost archive_directory