Skip to content

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

Description

@renato-machado-atman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions