RE: Support tab completion for upper character inputs in psql

From: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "smithpb2250(at)gmail(dot)com" <smithpb2250(at)gmail(dot)com>, "david(dot)zhang(at)highgo(dot)ca" <david(dot)zhang(at)highgo(dot)ca>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Support tab completion for upper character inputs in psql
Date: 2022-01-28 06:37:07
Message-ID: OS0PR01MB611360D58EA41FC6557D92C0FB229@OS0PR01MB6113.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, January 28, 2022 5:24 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Here's a fleshed-out patch series for this idea.

Thanks for you patch.
I did some tests on it and here are something cases I feel we need to confirm
whether they are suitable.

1) postgres=# create table atest(id int, "iD" int, "ID" int);
2) CREATE TABLE
3) postgres=# alter table atest rename i[TAB]
4) id "iD"
5) postgres=# alter table atest rename I[TAB]
6) id "iD"

The tab completion for 5) ignored "ID", is that correct?

7) postgres=# create table "aTest"("myCol" int, mycol int);
8) CREATE TABLE
9) postgres=# alter table a[TAB]
10) ALL IN TABLESPACE atest "aTest"
11) postgres=# alter table aT[TAB] -> atest

I think what we are trying to do is to ease the burden of typing double quote for user.
But in line 11), the tab completion for "alter table aT[TAB]" is attest,
which makes the tab completion output of "aTest" at 10) no value.
Because if user needs to alter table aTest they still needs to
type double quote manually.

Another thing is the inconsistency of the output result.
12) postgres=# alter table atest rename i[TAB]
13) id "iD"
14) postgres=# alter table atest rename "i[TAB]
15) "id" "iD"

By applying the new fix, Line 15 added the output of "id".
I think it's good to keep user input '"' and convenient when using tab completion.
One the other hand, I'm not so comfortable with the output of "iD" in line 13.
If user doesn't type double quote, why we add double quote to the output?
Could we make the output of 13) like below?
12) postgres=# alter table atest rename i[TAB]
??) id iD

Regards,
Tang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-01-28 06:39:28 Re: Add checkpoint and redo LSN to LogCheckpointEnd log message
Previous Message Amit Kapila 2022-01-28 05:59:08 Re: Design of pg_stat_subscription_workers vs pgstats