Fix REPACK with WITHOUT OVERLAPS replica identity indexes
Álvaro Herrera <alvherre@kurilemu.de>
Fix REPACK with WITHOUT OVERLAPS replica identity indexes REPACK replay builds scan keys for the replica identity index, but it hard-coded BTEqualStrategyNumber when looking up the equality operator. That is not correct for non-btree identity indexes, such as the GiST indexes created for WITHOUT OVERLAPS primary keys. In addition, find_target_tuple() accepted the first tuple returned by the identity index scan, which is unsafe for lossy index scans because the index AM may return false positives with xs_recheck set. Fix this by using IndexAmTranslateCompareType() to translate COMPARE_EQ to the equality strategy number for the index AM, and by continuing the scan when recheck is required until a candidate tuple matches the locator tuple on all replica identity key columns. The recheck uses the same equality operator functions as the identity index scan keys, preserving ScanKey argument ordering. Author: Chao Li <lic@highgo.com> Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/7B0EC0EC-5461-41EF-9B31-F9BBE608DEA5@gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/repack.c | modified | +79 −6 |
| src/test/modules/injection_points/expected/repack_temporal_multirange.out | added | +74 −0 |
| src/test/modules/injection_points/expected/repack_temporal.out | added | +68 −0 |
| src/test/modules/injection_points/Makefile | modified | +2 −0 |
| src/test/modules/injection_points/meson.build | modified | +2 −0 |
| src/test/modules/injection_points/specs/repack_temporal_multirange.spec | added | +102 −0 |
| src/test/modules/injection_points/specs/repack_temporal.spec | added | +90 −0 |
Discussion
- Fix REPACK with WITHOUT OVERLAPS replica identity indexes 10 messages · 2026-05-08 → 2026-05-13