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-30 07:07:17 |
Message-ID: | OS0PR01MB611316C146B24C6C156AE455FB249@OS0PR01MB6113.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Saturday, January 29, 2022 1:03 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com> writes:
> > 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?
>
> Perhaps I misunderstood your original complaint, but what I thought
> you were unhappy about was that unquoted ID is a legal spelling of
> "id" and so I<TAB> ought to be willing to complete that. These
> examples with case variants of the same word are of some interest,
> but people aren't really going to create tables with these sorts of
> names, so we shouldn't let them drive the design IMO.
>
> Anyway, the existing behavior for these examples is
>
> alter table atest rename i<TAB> --- completes immediately to id
> alter table atest rename I<TAB> --- offers nothing
>
> It's certainly arguable that the first case is right as-is and we
> shouldn't change it. I think that could be handled by tweaking my
> patch so that it wouldn't offer completions that start with a quote
> unless the input word does. That would also cause I<TAB> to complete
> immediately to id, which is arguably fine.
>
> > I think what we are trying to do is to ease the burden of typing double quote
> for user.
>
> I'm not thinking about it that way at all. To me, the goal is to make
> tab completion do something sensible when presented with legal variant
> spellings of a word. The two cases where it currently fails to do
> that are (1) unquoted input that needs to be downcased, and (2) input
> that is quoted when it doesn't strictly need to be.
>
> To the extent that we can supply a required quote that the user
> failed to type, that's fine, but it's not a primary goal of the patch.
> Examples like these make me question whether it's even something we
> want; it's resulting in extraneous matches that people might find more
> annoying than helpful. Now I *think* that these aren't realistic
> cases and that in real cases adding quotes will be helpful more often
> than not, but it's debatable.
>
> > 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?
>
> That's certainly a valid argument.
>
> > Could we make the output of 13) like below?
> > 12) postgres=# alter table atest rename i[TAB]
> > ??) id iD
>
> That doesn't seem sensible at all.
Thanks for your kindly explanation.
I'm fine with the current tap completion style with your V16 patch.
Regards,
Tang
From | Date | Subject | |
---|---|---|---|
Next Message | tanghy.fnst@fujitsu.com | 2022-01-30 07:13:40 | RE: Support tab completion for upper character inputs in psql |
Previous Message | Mark Dilger | 2022-01-30 05:58:38 | Re: CREATEROLE and role ownership hierarchies |