Re: Adding REPACK [concurrently] - Mailing list pgsql-hackers

From Mihail Nikalayeu
Subject Re: Adding REPACK [concurrently]
Date
Msg-id CADzfLwVVxC-Ptp98B=gTQgT7uuWY1KnQDLBhGkP1NS3iz-AYcA@mail.gmail.com
Whole thread
In response to Re: Adding REPACK [concurrently]  (Antonin Houska <ah@cybertec.at>)
Responses Re: Adding REPACK [concurrently]
List pgsql-hackers
Hello!

On Thu, Mar 5, 2026 at 8:06 PM Antonin Houska <ah@cybertec.at> wrote:
> This is it. One more diff added, to engage BulkInsertState.

Few more comments:

> * In case functions in the index need the active snapshot and caller
> * hasn't set one.

Looks like a stale comment.

-----------

> recheck = ExecInsertIndexTuples(iistate->rri,
>                         iistate->estate,
>                         0,
>                         index_slot,
>                         NIL, NULL);

Such code in apply_concurrent_update and apply_concurrent_insert.
AFAIU we need to call ResetPerTupleExprContext(iistate->estate); after
list_free(recheck); to avoid small per-row memory leak.

-----------------

In find_target_tuple index_rescan is called before setting the
sk_argument - it works, but feels to be incorrect for the common case.
We should call it once entry->sk_argument is ready.

-----------------

I put possible fixes into the attached patch.

Mikhail.

Attachment

pgsql-hackers by date:

Previous
From: Evgeny Voropaev
Date:
Subject: Compress prune/freeze records with Delta Frame of Reference algorithm
Next
From: Nick Cleaton
Date:
Subject: Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch