[PATCH] Fix psql tab completion for REPACK boolean options

Baji Shaik <baji.pgdev@gmail.com>

From: Baji Shaik <baji.pgdev@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2026-05-11T19:45:34Z
Lists: pgsql-hackers

Attachments

Hi,

I noticed that psql's tab completion for REPACK's parenthesized
boolean options (ANALYZE, CONCURRENTLY, VERBOSE) does not offer
ON/OFF after typing one of these keywords.
For example:
    REPACK (VERBOSE <Tab>       -- nothing offered
  VACUUM (VERBOSE <Tab>       -- correctly offers ON/OFF

The issue is in tab-complete.in.c. The code uses:

    TailMatches("ANALYZE", "CONCURRENTLY", "VERBOSE")

With comma-separated arguments, TailMatches matches a sequence of
consecutive words. So this only matches when all three words appear
in order, which is not a valid REPACK syntax.

The fix is to use pipe-separated alternatives (matching any one of
the keywords), consistent with how VACUUM handles the same pattern:

    TailMatches("ANALYZE|CONCURRENTLY|VERBOSE")

Patch attached.

Thanks,
Baji Shaik
AWS RDS