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

From Álvaro Herrera
Subject Re: BUG #19414: Wrong rows returned by index scan on HASH-partitioned table with PRIMARY KEY (PostgreSQL 16.9)
Date
Msg-id 202602241212.66mpejc6pwpq@alvherre.pgsql
Whole thread Raw
In response to Re: BUG #19414: Wrong rows returned by index scan on HASH-partitioned table with PRIMARY KEY (PostgreSQL 16.9)  (José Antonio Morcillo Valenciano <jose.morcillo.valenciano@gmail.com>)
List pgsql-bugs
On 2026-Feb-24, José Antonio Morcillo Valenciano wrote:

> Hi!
> 
> After upgrading we reindex all our databases, so I don't see it clear.

Oh, sorry, you're right, the problem is potentially not with indexes,
but instead it's with the partition key.  This would mean that some rows
which previously belonged in one partition, should after the upgrade be
moved to some other partition due to changes in collation rules.  

I suspect it's not easy to find such items without fully scanning each
partition.  Failing that, you would have to recheck the partition
constraint for each row in each partition, and move rows across
partitions if the partition constraint fails to hold.  I don't have a
clear idea how to automate this.

> The difficulty here is finding a test case to work with.

Yes, that is ONE difficulty, but I don't think it's the only one, or
even the most difficult one.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
¡Ay, ay, ay!  Con lo mucho que yo lo quería (bis)
se fue de mi vera ... se fue para siempre, pa toíta ... pa toíta la vida
¡Ay Camarón! ¡Ay Camarón!                                (Paco de Lucía)



pgsql-bugs by date:

Previous
From: José Antonio Morcillo Valenciano
Date:
Subject: Re: BUG #19414: Wrong rows returned by index scan on HASH-partitioned table with PRIMARY KEY (PostgreSQL 16.9)
Next
From: Nathan Bossart
Date:
Subject: Re: basic_archive lost archive_directory