Re: psql: fix variable existence tab completion

Alexander Korotkov <aekorotkov@gmail.com>

From: Alexander Korotkov <aekorotkov@gmail.com>
To: Erik Wienhold <ewie@ewie.name>
Cc: Steve Chavez <steve@supabase.io>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-03-14T14:57:01Z
Lists: pgsql-hackers
On Sun, Mar 3, 2024 at 5:37 PM Erik Wienhold <ewie@ewie.name> wrote:
> On 2024-03-03 03:00 +0100, Steve Chavez wrote:
> > psql has the :{?name} syntax for testing a psql variable existence.
> >
> > But currently doing \echo :{?VERB<Tab> doesn't trigger tab completion.
> >
> > This patch fixes it. I've also included a TAP test.
>
> Thanks.  The code looks good, all tests pass, and the tab completion
> works as expected when testing manually.

A nice improvement.  I've checked why we have at all the '{' at
WORD_BREAKS and if we're going to break anything by removing that.  It
seems that '{' here from the very beginning and it comes from the
default value of rl_basic_word_break_characters [1].  It seems that
:{?name} is the only usage of '{' sign in psql.  So, removing it from
WORD_BREAKS shouldn't break anything.

I'm going to push this patch if no objections.

Links.
1. https://tiswww.case.edu/php/chet/readline/readline.html#index-rl_005fbasic_005fword_005fbreak_005fcharacters

------
Regards,
Alexander Korotkov



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove test-case workarounds for ancient libedit versions.

  2. psql: fix variable existence tab completion