Support tab completion for upper character inputs in psql

Tang, Haiying <tanghy.fnst@cn.fujitsu.com>

From: "Tang, Haiying" <tanghy.fnst@cn.fujitsu.com>
To: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-02-07T07:06:09Z
Lists: pgsql-hackers

Attachments

Hi Hackers,

When using psql I found there's no tab completion for upper character inputs. It's really inconvenient sometimes so I try to fix this problem in the attached patch.

Here is the examples to show what this patch can do.
Action: 
1. connect the db using psql 
2. input SQL command
3. enter TAB key(twice at the very first time)

Results:
[master]
postgres=# set a
all                      allow_system_table_mods  application_name         array_nulls
postgres=# set A

postgres=# set A

[patched]
postgres=# set a
all                      allow_system_table_mods  application_name         array_nulls
postgres=# set A
ALL                      ALLOW_SYSTEM_TABLE_MODS  APPLICATION_NAME         ARRAY_NULLS
postgres=# set A

Please take a check at this patch. Any comment is welcome.

Regards,
Tang 


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