Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7yIv-0001yN-Gl for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jan 2022 11:30:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7yIt-0005pn-Uq for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jan 2022 11:30:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7yIt-0005pe-Cw for pgsql-hackers@lists.postgresql.org; Thu, 13 Jan 2022 11:30:03 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7yIp-0003F6-Fb for pgsql-hackers@lists.postgresql.org; Thu, 13 Jan 2022 11:30:02 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id AD9175C0229; Thu, 13 Jan 2022 06:29:57 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 13 Jan 2022 06:29:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=GJKD5Tr65d1IWcqKlRPJ0eFRAZSEmcyUSseD/32b5 Mo=; b=Z3Vo/gdovPjbDyYTG0tftpiBJEU+AtiRvuDVgEJB45f/W0ZsAlF8SHdqg P+//BEXd6AS3h5tp2gczZLC3Ifugu7yPEntZX+Y/ceSM4161GQKqJ3tacrGeRWCO LQWKpDybvf/+yQ9DRy03md1zB/ia3bBe1XqOVWJzLjQA4cn94sI84WHNdh4gg88Q QtFr+zrdb4aKystMxc//J6qnGn0VuEjHxgvdRfIIutqFphdSTRr//iMpNzeb985p 1HgSV5qTr5BqmZMnTFS7+9RdfMyakid83GBZmK1OxxjxuZIdZifDxDVEuNunAC9r bFVbO3jqYZMHIn9QsQNRomkF0bkAw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrtdefgddvjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvghtvghr ucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnthgvrh hprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeffvefgueduueelieeufeej vdfhffettddtudegvdeuuedtuddvhedvheffudejhfenucffohhmrghinhepphhoshhtgh hrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusg drtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Jan 2022 06:29:55 -0500 (EST) Message-ID: Date: Thu, 13 Jan 2022 12:29:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: Support tab completion for upper character inputs in psql Content-Language: en-US To: "tanghy.fnst@fujitsu.com" , Japin Li Cc: Tom Lane , Kyotaro Horiguchi , Laurenz Albe , "smithpb2250@gmail.com" , "david.zhang@highgo.ca" , "pgsql-hackers@lists.postgresql.org" References: <20210423.115812.900808736988307020.horikyota.ntt@gmail.com> <80b093ae-88bd-8d8a-68b9-b535a3ab11be@enterprisedb.com> <54bd7839-f463-ef03-f2d2-ccb8184b9b27@enterprisedb.com> <1068530.1641480996@sss.pgh.pa.us> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 07.01.22 06:17, tanghy.fnst@fujitsu.com wrote: > On Friday, January 7, 2022 1:08 PM, Japin Li 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