pgadmin-org / pgadmin-org/pgadmin4
Maintenance dialog REINDEX generates invalid SQL when "Concurrently" is enabled ("syntax error at or near CONCURRENTLY")
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 891
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 8
Description
Bug report
pgAdmin version: 9.17
PostgreSQL version: 13.2
OS: Ubuntu 24.04.4 LTS
Description
Running REINDEX TABLE with the "Concurrently" option enabled from the
Maintenance dialog generates invalid SQL. CONCURRENTLY is placed inside
the parenthesized option list alongside VERBOSE, but PostgreSQL only
accepts CONCURRENTLY as a standalone keyword placed between the target
type and the target name — not as a parenthesized option.
Steps to reproduce
- Right-click a table (e.g.
public."Command") → Maintenance... - Select "REINDEX", enable "Verbose" and "Concurrently"
- Run
Generated SQL (invalid)
sql REINDEX (VERBOSE, CONCURRENTLY) TABLE public."Command";
Error
ERROR: syntax error at or near "CONCURRENTLY" LINE 1: REINDEX (VERBOSE, CONCURRENTLY) TABLE public."Command"; ^
Expected SQL
sql REINDEX (VERBOSE) TABLE CONCURRENTLY public."Command";
Root cause (from source)
In web/pgadmin/tools/maintenance/templates/maintenance/sql/command.sql,
CONCURRENTLY is appended to the same maintenance_options list as
VERBOSE/TABLESPACE/etc., and the whole list is rendered inside a single
(...) clause before the target type/name. Per the PostgreSQL grammar,
CONCURRENTLY is not a parenthesizable REINDEX option — it must appear
after the object type keyword (TABLE/INDEX/SCHEMA/...) and before the
object name. The template needs to emit CONCURRENTLY there instead of
inside the options parens.
Impact
Any REINDEX (TABLE/INDEX/SCHEMA/DATABASE/SYSTEM) run via the Maintenance
dialog with "Concurrently" checked fails outright with a syntax error,
making the feature unusable from the UI. Workaround: run the corrected SQL
manually in the Query Tool.
Screenshot
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with web/pgadmin/tools/maintenance/templates/maintenance/sql/command.sql and inspect how REINDEX options and target names are rendered. Reproduce the Maintenance dialog case for TABLE, then verify the generated SQL uses valid PostgreSQL syntax for the supported REINDEX target types and that the dialog no longer fails with Concurrently enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100