Re: [PATCH] Fix psql tab completion for REPACK boolean options

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Baji Shaik <baji(dot)pgdev(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix psql tab completion for REPACK boolean options
Date: 2026-05-13 03:16:14
Message-ID: CAHGQGwELJkyH+JH6j=rxgNhs_EA8+49kj65YbH85x-QG79qWyg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 12, 2026 at 4:45 AM Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> wrote:
>
> 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 for the patch! It looks good to me.
Unless there are objections, I will commit it.

BTW, I found that the boolean options for CLUSTER and REINDEX have
the same issue, i.e., tab completion does not suggest boolean values
such as ON and OFF. However, this has existed for a while, and adding
those completions seems more like an improvement than a bug fix,
so it should probably be handled separately during v20 development.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-05-13 03:45:07 Re: [PATCH] Fix REPACK decoding worker not cleaned up on FATAL exit
Previous Message Tatsuo Ishii 2026-05-13 03:11:14 Re: Row pattern recognition