pgadmin-org / pgadmin-org/pgadmin4

Maintenance dialog REINDEX generates invalid SQL when "Concurrently" is enabled ("syntax error at or near CONCURRENTLY")

Open Beginner friendly
#10,251 0 comments 0 reactions 0 assignees View on GitHub

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
  1. Right-click a table (e.g. public."Command") → Maintenance...
  2. Select "REINDEX", enable "Verbose" and "Concurrently"
  3. 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
Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.