Re: psql tab completion versus Debian's libedit - Mailing list pgsql-hackers

From Tom Lane
Subject Re: psql tab completion versus Debian's libedit
Date
Msg-id 147685.1643858911@sss.pgh.pa.us
Whole thread Raw
In response to Re: psql tab completion versus Debian's libedit  (Andres Freund <andres@anarazel.de>)
Responses Re: psql tab completion versus Debian's libedit  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> I think this is caused by the feature flag detection being broken in the meson
> branch - unrelated to your commit - ending up with falsely believing that none
> of the rl_* variables exist (below for more on that aspect).
> Do we care that the tests would fail when using a readline without any of the
> rl_* variables? I don't know if those even exist.

Hm, interesting.  I reproduced this by #undef'ing
HAVE_RL_COMPLETION_APPEND_CHARACTER in pg_config.h.  It's not too
surprising, because without that, we have no way to prevent readline
from appending a space to a completion.  In the test at hand, that
causes two failures:

1. After we do "pub<TAB>", we get "public. " not just "public.";
and now, that is no longer part of the word-to-be-completed.
That breaks the test because FROM is no longer the previous word
but the one before that, so we won't try to do table completion.

2. After we do "tab<TAB>", we normally get "tab1 ", but since no
completion is attempted, we should get just "tab".  But we
get "tab " because the dummy-completion code at the bottom
of psql_completion fails to suppress adding a space.  In general,
*any* failed completion would nonetheless append a space.

Each of these is sufficiently bad to prompt user complaints,
I think, but we've seen none.  And I observe that every buildfarm
animal reports having rl_completion_append_character.

I conclude that there are no extant versions of readline/libedit
that don't have rl_completion_append_character, so we could
drop that configure test and save a cycle or two.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bugs in pgoutput.c
Next
From: Andres Freund
Date:
Subject: Re: psql tab completion versus Debian's libedit