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/
0001-Check-for-transaction-block-early-in-ExecRepack.patch
Description: Binary data
