Re: REPACK (ANALYZE) within transaction block segfaults

From: Osama Abdul Qader <osamaabdulqader(dot)cs(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, Alvaro Herrera <alvherre(at)kurilemu(dot)de>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: REPACK (ANALYZE) within transaction block segfaults
Date: 2026-09-03 16:29:06
Message-ID: CAC+8b5gCW3gU7KS1Jj=csgYkMhQ75DeKAPB15e9BT+4ZsbGLJw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Good Evening Masao San

Thanks for the detailed review.

I understood and I'll update the patch to:

- document the transaction-block restriction in repack documentation.
- revise the comment in 'repack.c' to reflect that this is an
intentional restriction for v19, rather than an inherent requirement; and
- expand the regression tests to cover plain REPACK inside a transaction
block, REPACK (ANALYZE) inside a transaction block, and REPACK (ANALYZE)
from a DO block.

I'll send an updated patch once these changes are made.

With regards,
Osama Abdul Qader

On Thu, 3 Sept, 2026, 7:21 pm Fujii Masao, <masao(dot)fujii(at)gmail(dot)com> wrote:

> On Thu, Sep 3, 2026 at 5:27 PM Osama Abdul Qader
> <osamaabdulqader(dot)cs(at)gmail(dot)com> wrote:
> > The updated patch is attached.
>
> Thanks for updating the patch!
>
> I have a few review comments.
>
> As I told upthread, I think the restriction that REPACK (ANALYZE) cannot
> be executed inside a transaction block should be documented. For example,
> how about adding something like the following to the description of
> the ANALYZE option in the REPACK docs?
>
> This option cannot be used inside a transaction block, or from a
> function, procedure, or <command>DO</command> block.
>
>
> + * It therefore cannot be executed inside a transaction block or
>
> Is this really true? As discussed upthread, I was thinking that it can
> be executed even inside a transaction block, but that we decided to
> intentionally prevent it from doing so to match the behavior of
> VACUUM (FULL, ANALYZE) as the safe behavior for v19. No?
>
>
> Regarding the tests, as I told upthread, I think it's better to also
> cover the following cases:
>
> - plain REPACK is allowed in a transaction block
> - REPACK (ANALYZE) is not allowed from a function
>
> For example:
>
> -------------------------
> --- Verify partial analyze works
> +-- Verify REPACK (ANALYZE) works, including partial analyze.
> REPACK (ANALYZE) clstr_tst (a);
> REPACK (ANALYZE) clstr_tst;
> +-- Plain REPACK is allowed in a transaction block.
> +BEGIN;
> +REPACK clstr_tst;
> +ROLLBACK;
> +-- REPACK (ANALYZE) is not allowed in a transaction block.
> +BEGIN;
> +REPACK (ANALYZE) clstr_tst;
> +ROLLBACK;
> +-- REPACK (ANALYZE) is not allowed from a function.
> +DO $$ BEGIN EXECUTE 'REPACK (ANALYZE) clstr_tst'; END $$;
> -------------------------
>
> Regards,
>
>
> --
> Fujii Masao
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-09-03 16:46:56 Re: FOR PORTION OF silently ignored on views with DO INSTEAD rules
Previous Message Tom Lane 2026-09-03 16:28:50 Re: Improving display of octal GUCs