public inbox for [email protected]  
help / color / mirror / Atom feed
From: Kirill Reshke <[email protected]>
To: Chao Li <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Fix REPACK with WITHOUT OVERLAPS replica identity indexes
Date: Fri, 8 May 2026 22:47:39 +0500
Message-ID: <CALdSSPh9TMhgiAai4i7RtAUXRFtD-Lzhxm-YAY7-dzUAu=9yzQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Fri, 8 May 2026 at 09:22, Chao Li <[email protected]> wrote:
>
> 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/
>

your analysis appears correct to me

>  + while (index_getnext_slot(scan, ForwardScanDirection, retrieved))
> + {
> + if (scan->xs_recheck && !identity_key_equal(chgcxt, locator, retrieved))
> + continue;
> +
> + retval = true;
> + break;
> + }

Should we add CFI() ?


Also, do we really need isolation tests and inj points here? Doesn't a
simple regression test for REPACK execute the same code?


-- 
Best regards,
Kirill Reshke





view thread (10+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Fix REPACK with WITHOUT OVERLAPS replica identity indexes
  In-Reply-To: <CALdSSPh9TMhgiAai4i7RtAUXRFtD-Lzhxm-YAY7-dzUAu=9yzQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox