Re: REPACK (ANALYZE) within transaction block segfaults

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Osama Abdul Qader <osamaabdulqader(dot)cs(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 13:50:52
Message-ID: CAHGQGwGKdV8Hw-f430qacdtEGkYnc-DbQd0W1opx+wCO9fcdxg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 Tom Lane 2026-09-03 13:52:07 Re: new clang warnings about unused global variables
Previous Message Amit Langote 2026-09-03 13:36:06 Revert RI fast-path batching from REL_19_STABLE