Re: psql tab completion versus Debian's libedit

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, pgbf(at)twiska(dot)com
Subject: Re: psql tab completion versus Debian's libedit
Date: 2022-02-03 03:28:31
Message-ID: 147685.1643858911@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-02-03 03:33:43 Re: psql tab completion versus Debian's libedit
Previous Message Tom Lane 2022-02-03 02:48:18 Re: Bugs in pgoutput.c