From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: tanghy.fnst@fujitsu.com <tanghy.fnst@fujitsu.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: smithpb2250@gmail.com <smithpb2250@gmail.com>
Cc: david.zhang@highgo.ca <david.zhang@highgo.ca>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: Support tab completion for upper character inputs in psql
Date: Tue, 7 Sep 2021 10:25:20 +0200
Message-ID: <80b093ae-88bd-8d8a-68b9-b535a3ab11be@enterprisedb.com> (raw)
In-Reply-To: <OS0PR01MB61136721363BD08576725F22FB089@OS0PR01MB6113.jpnprd01.prod.outlook.com>
References: <OS0PR01MB611303B647967B6949B759F1FB4E9@OS0PR01MB6113.jpnprd01.prod.outlook.com>
<CAHut+Pu+Jcpjrry8t29J99+v09Ou0MSLZCqghUAoeyfCnOpznA@mail.gmail.com>
<OS0PR01MB61131A4347D385F02F60E123FB469@OS0PR01MB6113.jpnprd01.prod.outlook.com>
<20210423.115812.900808736988307020.horikyota.ntt@gmail.com>
<OS0PR01MB6113CA04E06D5BF221BC4FE2FB429@OS0PR01MB6113.jpnprd01.prod.outlook.com>
<OS0PR01MB61136721363BD08576725F22FB089@OS0PR01MB6113.jpnprd01.prod.outlook.com>
On 23.06.21 14:43, tanghy.fnst@fujitsu.com wrote:
> I've updated the patch to V8 since Tom, Kyotaro and Laurenz discussed the lower case issue of German/Turkish language at [1].
>
> Differences from V7 are:
> * Add a function valid_input_text which checks the input text to see if it only contains alphabet letters, numbers etc.
> * Delete the flag setting of "completion_case_sensitive=false" which introduced in V1 patch and no use now.
>
> As you can see, now the patch limited the lower case transform of the input to alphabet letters.
> By doing that, language like German/Turkish will not affected by this patch.
>
> Any comment or suggestion on this patch is very welcome.
The coding of valid_input_text() seems a bit bulky. I think you can do
the same thing using strspn() without a loop.
The name is also not great. It's not like other strings are not "valid".
There is also no explanation why that specific set of characters is
allowed and not others. Does it have something to do with identifier
syntax? This needs to be explained.
Seeing that valid_input_text() is always called together with
pg_string_tolower(), I think those could be combined into one function,
like pg_string_tolower_if_ascii() is whatever. That would save a lot of
repetition.
There are a couple of queries where the result is *not*
case-insensitive, namely
Query_for_list_of_enum_values
Query_for_list_of_available_extension_versions
(and their variants). These are cases where the query result is not
used as an identifier but as a (single-quoted) string. So that needs to
be handled somehow, perhaps by adding a COMPLETE_WITH_QUERY_CS() similar
to COMPLETE_WITH_CS().
(A test case for the enum case should be doable easily.)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@enterprisedb.com, tanghy.fnst@fujitsu.com, tgl@sss.pgh.pa.us, horikyota.ntt@gmail.com, laurenz.albe@cybertec.at, smithpb2250@gmail.com, david.zhang@highgo.ca, pgsql-hackers@lists.postgresql.org
Subject: Re: Support tab completion for upper character inputs in psql
In-Reply-To: <80b093ae-88bd-8d8a-68b9-b535a3ab11be@enterprisedb.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox