Re: Support tab completion for upper character inputs in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, 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-02-04 23:41:21
Message-ID: 445692.1644018081@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

=?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= <ilmari(at)ilmari(dot)org> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>>> We could do something hacky like matching case only when there's
>>> no longer any matching object names, but that might be too magic.

>> I experimented with that, and it actually doesn't seem as weird
>> as I feared. See if you like this ...

> That's a reasonable compromise, and the implementation is indeed less
> hacky than one might have feared. Although I think putting the
> `num_keywords` variable before `num_other` would read better.

After a few days of using that, I'm having second thoughts about it,
because it turns out to impede completion in common cases. For
example,

regression=# set transa<TAB><TAB>
TRANSACTION transaction_isolation
transaction_deferrable transaction_read_only

It won't fill in "ction" because of the case discrepancy between the
offered alternatives. Maybe this trumps the question of whether you
should be able to distinguish keywords from non-keywords in the menus.
If we case-folded the keywords as per your original proposal, it'd do
what I expect it to.

In previous releases, this worked as expected: "set transa<TAB>"
immediately completes "ction", and then tabbing produces this
menu:

transaction transaction_isolation
transaction_deferrable transaction_read_only

That probably explains why these keywords were lower-cased in
the previous code. However, I don't think we should blame
your suggestion to upcase them, because the same problem arises
in other completion contexts where we offer keywords. We should
solve it across-the-board not just for these specific queries.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-02-04 23:51:44 Re: support for CREATE MODULE
Previous Message Nathan Bossart 2022-02-04 23:33:48 Re: support for CREATE MODULE