Re: Support tab completion for upper character inputs in psql

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>, Tom Lane <tgl@sss.pgh.pa.us>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Laurenz Albe <laurenz.albe@cybertec.at>
Cc: "smithpb2250@gmail.com" <smithpb2250@gmail.com>, "david.zhang@highgo.ca" <david.zhang@highgo.ca>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2022-01-06T07:46:48Z
Lists: pgsql-hackers
On 10.09.21 15:50, tanghy.fnst@fujitsu.com wrote:
>> (A test case for the enum case should be doable easily.)
> Test added.

The enum test is failing on *some* platforms:

t/010_tab_completion.pl .. 26/?
#   Failed test 'complete enum values'
#   at t/010_tab_completion.pl line 211.
# Actual output was "ALTER TYPE mytype1 RENAME VALUE '\a\r\n'BLUE' 
'bLACK'  'green'  \r\npostgres=# ALTER TYPE mytype1 RENAME VALUE '"
# Did not match "(?^:'bLACK' + 'BLUE' + 'green')"

So the ordering of the suggested completions is different.  I don't know 
offhand how that ordering is determined.  Perhaps it's dependent on 
locale, readline version, or operating system.  In any case, we need to 
figure this out to make this test stable.



Commits

  1. Fix minor memory leaks in psql's tab completion.

  2. Further tweaks for psql's new tab-completion logic.

  3. Treat case of tab-completion keywords a bit more carefully.

  4. psql: improve tab-complete's handling of variant SQL names.

  5. Make PQcancel use the PGconn's tcp_user_timeout and keepalives settings.

  6. Use a WaitLatch for vacuum/autovacuum sleeping