Subject: Re: Adding REPACK [concurrently]

From: Srinath Reddy Sadipiralla <[email-masked]>
Date: Wed, 25 Mar 2026 21:22:16 +0530

Hello,

While reviewing/testing V44 patch set , i found that if we run REPACK
(CONCURRENTLY)
without a table name inside a transaction block throws the error "REPACK
CONCURRENTLY requires explicit
table name" instead of the expected transaction block error. This occurs
because ExecRepack() validates the parsed options and missing relation
before verifying the transaction state.

I attached a patch below to maintain consistency with other commands like
VACUUM, REINDEX , and more
and also not to confuse the user , because if user runs REPACK
(CONCURRENTLY)
without a table name inside a transaction block, if user gets "REPACK
CONCURRENTLY requires explicit
table name" and then to correct the mistake the user gives table and again
runs the in
transaction block , just to find out a new error "cannot run inside a
transaction block".

psql (19devel)
Type "help" for help.

postgres=# BEGIN;
SET TRANSACTION READ ONLY;
BEGIN
SET
postgres=*# REPACK (concurrently);
ERROR:  REPACK CONCURRENTLY requires explicit table name

psql (19devel)
Type "help" for help.

postgres=# BEGIN;
SET TRANSACTION READ ONLY;
BEGIN
SET
postgres=*# REPACK (concurrently) stress_victim;
ERROR:  REPACK (CONCURRENTLY) cannot run inside a transaction block

After the fix:

psql (19devel)
Type "help" for help.

postgres=# BEGIN;
SET TRANSACTION READ ONLY;
BEGIN
SET
postgres=*# REPACK (concurrently);
ERROR:  REPACK (CONCURRENTLY) cannot run inside a transaction block

Thoughts?

-- 
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/

---

From: Srinath Reddy Sadipiralla <[email-masked]>
Date: Wed, 25 Mar 2026 21:29:11 +0530

Sorry my bad :( , I attached my patch with *.patch instead of *.something
or "nocfbot" prefix.
-- 
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/

---

From: Srinath Reddy Sadipiralla <[email-masked]>
Date: Sat, 28 Mar 2026 00:12:18 +0530

Hi Alvaro,

On Fri, Mar 27, 2026 at 12:45 AM Alvaro Herrera <[email-masked]>
wrote:

>
> I don't disagree with changing this, but AFAICS the patch as presented
> provokes multiple test failures.
>

Fixed with the attached patch.

---

From: Srinath Reddy Sadipiralla <[email-masked]>
Date: Thu, 2 Apr 2026 06:05:45 +0530

> Fixed with the attached patch.

Just want to remind about this patch.

---

From: Alvaro Herrera <[email-masked]>
Date: Thu, 2 Apr 2026 10:27:21 +0200

> Just want to remind about this patch.

Yeah, it doesn't apply anymore.  I rebased it some time ago, but it
still failed a few tests -- I'm guessing you don't have either TAP tests
or injection points enabled, which would explain why you don't see those
failures.  So please rebase it against v49, but also look into making it
pass all tests (I suggest making it go through CI).

Thanks,

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"We’ve narrowed the problem down to the customer’s pants being in a situation
 of vigorous combustion" (Robert Haas, Postgres expert extraordinaire)

---

From: Srinath Reddy Sadipiralla <[email-masked]>
Date: Fri, 3 Apr 2026 21:28:16 +0530

> pass all tests (I suggest making it go through CI).

Rebased on V50 and check-world passed.