Re: pgsql: Add basic TAP tests for psql's tab-completion logic. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
Date
Msg-id 3055.1578115809@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Add basic TAP tests for psql's tab-completion logic.  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: pgsql: Add basic TAP tests for psql's tab-completion logic.  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
Peter Geoghegan <pg@bowt.ie> writes:
> On Fri, Jan 3, 2020 at 7:06 PM Peter Geoghegan <pg@bowt.ie> wrote:
>> No. Also tried setting PG_COLOR="off" and CLICOLOR=0 -- that also
>> didn't help. (This was based on possibly-relevant vars that "env"
>> showed were set).

Yeah, that's not terribly surprising, because if I'm reading those
escape sequences correctly they're not about color.  They seem to be
just cursor movement and line clearing, according to [1].

What I'm mystified by is why your copy of libreadline is choosing to
do that, rather than just space over to where the word should be printed
which is what every other copy seems to be doing.  I have a fresh new
Debian installation at hand, with

$ dpkg -l | grep readline
ii  libreadline-dev:amd64                 7.0-5                                amd64        GNU readline and history
libraries,development files 
ii  libreadline5:amd64                    5.2+dfsg-3+b13                       amd64        GNU readline and history
libraries,run-time libraries 
ii  libreadline7:amd64                    7.0-5                                amd64        GNU readline and history
libraries,run-time libraries 
ii  readline-common                       7.0-5                                all          GNU readline and history
libraries,common files 

and I'm not seeing the failure on it, either with TERM=xterm
or with TERM=xterm-256color.  So what's the missing ingredient?

> Removing the single check_completion() test from 010_tab_completion.pl
> that actually fails on my system ("offer multiple table choices")
> fixes the problem for me -- everything else passes.
> I suppose that this means that the problem is in "offer multiple table
> choices" specifically.

I'd hate to conclude that we can't test any completion behavior that
involves offering a list.

If we can't coerce libreadline into being less avant-garde in its
screen management, I suppose we could write a regex to recognize
xterm escape sequences and ignore those.  But I'd be happier about
this if I could reproduce the behavior.  I don't like the feeling
that there's something going on here that I don't understand.

BTW, it seems somewhat likely that this is less about libreadline
than about its dependency libtinfo.  On my machine that's from

ii  libtinfo6:amd64                       6.1+20181013-2+deb10u2               amd64        shared low-level terminfo
libraryfor terminal handling 

what about yours?

            regards, tom lane

[1] https://www.xfree86.org/current/ctlseqs.html



pgsql-hackers by date:

Previous
From: Paul A Jungwirth
Date:
Subject: Re: range_agg
Next
From: Peter Geoghegan
Date:
Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.