Re: Adding REPACK [concurrently] - Mailing list pgsql-hackers

From Srinath Reddy Sadipiralla
Subject Re: Adding REPACK [concurrently]
Date
Msg-id CAFC+b6q6EsNqZ4+QugmMugbGChuJfu4HorJ3hZ0f6cyxCAxFgQ@mail.gmail.com
Whole thread
In response to Re: Adding REPACK [concurrently]  (Antonin Houska <ah@cybertec.at>)
Responses Re: Adding REPACK [concurrently]
Re: Adding REPACK [concurrently]
List pgsql-hackers
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/
Attachment

pgsql-hackers by date:

Previous
From: Yamaguchi Atsuo
Date:
Subject: Re: Add tab completion for SERVER and CONNECTION keywords in psql
Next
From: Srinath Reddy Sadipiralla
Date:
Subject: Re: Adding REPACK [concurrently]