Re: REPACK (ANALYZE) within transaction block segfaults

From: Osama Abdul Qader <osamaabdulqader(dot)cs(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, alvherre(at)kurilemu(dot)de
Subject: Re: REPACK (ANALYZE) within transaction block segfaults
Date: 2026-08-27 14:23:39
Message-ID: CAC+8b5imwCLpRQFTkHXnehbT4qP1ODQ_HAHVqGe35oixsWFAdA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Nathan,

Thanks for reporting this issue.

I haven't investigated this case yet, but I'll try to reproduce it as soon
as possible and look into the transaction/SPI handling around 'REPACK
(ANALYZE)'.

I'll follow up, once I got something concrete.

With best regards
Osama Abdul Qader

On Thu, 27 Aug, 2026, 7:26 pm Nathan Bossart, <nathandbossart(at)gmail(dot)com>
wrote:

> I didn't see this reported yet:
>
> CREATE TABLE t (a INT PRIMARY KEY, b TEXT);
> INSERT INTO t SELECT g, 'v' FROM generate_series(1, 100) g;
> DO $$ BEGIN EXECUTE 'REPACK (ANALYZE) t'; END $$;
>
> This produces the following output:
>
> WARNING: transaction left non-empty SPI stack
> HINT: Check for missing "SPI_finish" calls.
> WARNING: snapshot 0x8ef018100 still active
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
>
> Presumably we need to handle transaction blocks a bit like how vacuum()
> does. Or maybe even prevent REPACK (ANALYZE) within a transaction block.
>
> --
> nathan
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-08-27 14:31:21 Re: [PATCH] Use streaming read I/O in sample scans
Previous Message Nathan Bossart 2026-08-27 14:22:13 REPACK (CONCURRENTLY) rewrites tables marked with user_catalog_table