pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: tanghy.fnst@fujitsu.com <tanghy.fnst@fujitsu.com>
To: Japin Li <japinli@hotmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: 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: Thu, 13 Jan 2022 12:29:54 +0100
Message-ID: <c7fb9ad1-0b77-eda5-0055-02ee472e3a4a@enterprisedb.com> (raw)
In-Reply-To: <TYCPR01MB6128D4933189A74AAD326F98FB4D9@TYCPR01MB6128.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>
	<80b093ae-88bd-8d8a-68b9-b535a3ab11be@enterprisedb.com>
	<OS0PR01MB61137C7B2B09C0431415B9DBFBD69@OS0PR01MB6113.jpnprd01.prod.outlook.com>
	<54bd7839-f463-ef03-f2d2-ccb8184b9b27@enterprisedb.com>
	<1068530.1641480996@sss.pgh.pa.us>
	<TYCPR01MB6128BD8EA1529F4270114C18FB4D9@TYCPR01MB6128.jpnprd01.prod.outlook.com>
	<MEYP282MB1669EAF2183E67EAF86F7F61B64D9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
	<TYCPR01MB6128D4933189A74AAD326F98FB4D9@TYCPR01MB6128.jpnprd01.prod.outlook.com>

On 07.01.22 06:17, tanghy.fnst@fujitsu.com wrote:
> On Friday, January 7, 2022 1:08 PM, Japin Li <japinli@hotmail.com> wrote:
>> +/*
>> + * pg_string_tolower - Fold a string to lower case if the string is not quoted
>> + * and only contains ASCII characters.
>> + * For German/Turkish etc text, no change will be made.
>> + *
>> + * The returned value has to be freed.
>> + */
>> +static char *
>> +pg_string_tolower_if_ascii(const char *text)
>> +{
>>
>> s/pg_string_tolower/pg_string_tolower_if_ascii/ for comments.
>>
> 
> Thanks for your review.
> Comment fixed in the attached V11 patch.

As I just posted over at [0], the tab completion of enum values appears 
to be broken at the moment, so I can't really analyze what impact your 
patch would have on it.  (But it makes me suspicious about the test case 
in your patch.)  I suspect it would treat enum labels as 
case-insensitive, which would be wrong.  But we need to fix that issue 
first before we can proceed here.

The rest of the patch seems ok in principle, since AFAICT enums are the 
only query result in tab-complete.c that are not identifiers and thus 
subject to case issues.

I would perhaps move the pg_string_tolower_if_ascii() calls to before 
escape_string() in each case.  It won't make a difference to the result, 
but it seems conceptually better.


[0]: 
https://www.postgresql.org/message-id/8ca82d89-ec3d-8b28-8291-500efaf23b25@enterprisedb.com





view thread (54+ messages)  latest in thread

Message-ID: <c7fb9ad1-0b77-eda5-0055-02ee472e3a4a@enterprisedb.com>
Permalink:  ../c7fb9ad1-0b77-eda5-0055-02ee472e3a4a@enterprisedb.com/
Also on:    postgresql.org/message-id/c7fb9ad1-0b77-eda5-0055-02ee472e3a4a@enterprisedb.com

 · 

reply

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, japinli@hotmail.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: <c7fb9ad1-0b77-eda5-0055-02ee472e3a4a@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