Re: REPACK (ANALYZE) within transaction block segfaults

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org, alvherre(at)kurilemu(dot)de
Subject: Re: REPACK (ANALYZE) within transaction block segfaults
Date: 2026-09-02 05:26:47
Message-ID: CAHGQGwEezdMUixhJ-N0YO0OFUmh0uPaXRDkds5FS-5dmdwz4Bg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 29, 2026 at 4:52 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
> This is probably the way to go for v19. As you note, the analogous VACUUM
> command has long ERROR'd, and we could always look into removing this
> restriction in the future. I'd rather do it that way than ship an
> incorrect fix in v19 that will be tougher to back out.

I'm ok with this.

I have a few review comments on Antonin's patch.

As with my patch, I think it would be better to document the restriction
and add tests covering the following cases:

- plain REPACK is allowed in a transaction block
- REPACK (ANALYZE) is not allowed in a transaction block
- REPACK (ANALYZE) is not allowed from a function

+ * Technically, transaction block is not a problem for REPACK
+ * (ANALYZE), but if it's called from a pl/pgsql function,

Since it can also be called from procedures, functions and DO blocks,
mentioning only a PL/pgSQL function seems too narrow.

+ * cluster_rel() might start a new transaction while SPI session is in

Is this correct? It seems that the new transaction for ANALYZE is
started in process_single_relation(), not in cluster_rel().

+ * that's just consistent with VACUUM (FULL, ANALYZE), which is a
+ * synonym for REPACK (ANALYZE).

Is VACUUM (FULL, ANALYZE) really a synonym for REPACK (ANALYZE)?

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2026-09-02 05:27:26 Re: foreign_key test is sensitive to the OID counter
Previous Message Chao Li 2026-09-02 05:19:36 Re: Fix -Wshadow=local warnings