| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Fix REPACK with WITHOUT OVERLAPS replica identity indexes |
| Date: | 2026-05-08 04:21:53 |
| Message-ID: | 7B0EC0EC-5461-41EF-9B31-F9BBE608DEA5@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
While testing UPDATE FOR PORTION OF, I started wondering whether REPACK supports temporal tables. In theory, it should, because temporal WITHOUT OVERLAPS indexes can be used as replica identity indexes. So I created a test script, repack_temporal.spec, which is included in the attached patch, and it failed.
I found that REPACK hard-codes BTEqualStrategyNumber when calling get_opfamily_member(). That seems wrong, because build_replindex_scan_key() uses IndexAmTranslateCompareType() to get the equality strategy for COMPARE_EQ.
After fixing the hard-coded BTEqualStrategyNumber, the temporal test passed. Then I added another test for multirange, repack_temporal_multirange.spec, which also failed. The reason is that find_target_tuple() uses the identity index to find the first tuple and returns it directly, but a lossy index scan may return false positives and require recheck.
Please see the attached patch for the fix details and test scripts.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-REPACK-with-WITHOUT-OVERLAPS-replica-identity.patch | application/octet-stream | 16.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John Naylor | 2026-05-08 04:24:02 | errposition |
| Previous Message | Fujii Masao | 2026-05-08 04:21:31 | Re: Call EndCopyFrom() after initial table sync in logical replication |