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 1mNWQD-0007uE-Rn for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Sep 2021 08:25:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mNWQC-0001Pv-IH for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Sep 2021 08:25:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNWQB-0001Pk-OO for pgsql-hackers@lists.postgresql.org; Tue, 07 Sep 2021 08:25:36 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNWQ6-0006sv-0I for pgsql-hackers@lists.postgresql.org; Tue, 07 Sep 2021 08:25:35 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 5D507320082A; Tue, 7 Sep 2021 04:25:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 07 Sep 2021 04:25:25 -0400 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=fm3; bh=beRfX45Woaq8S+e1d+bLOUd7wc+qYrLxO4NVpBBjU D8=; b=gao/LxSMHbnCKbqvi4pNrNAPG8Txm3Nb7sX5yTaJairVa2Qr292eSZmPc v5DRLN4qtYXoCL65/6kd0lA6p4ZPGNCAJmIzBBouYKHtqsGh1Prvk+42EX2dWsi/ FWUgi3OPkPw9krIQ9so5J+XBLriW0DvtDlnTYXQ9vrU/txhEscacI19jJryz8Bh4 ikWwF5RGNw3+nUPzmWYOohN1AlT+oCXZdPuUDmmF3/apfVSqejlL9rNo+MjaMKcK NeEo7ABaoWyL1LkJO15ZU5H4zlJ9WovtkEuuh/rZERLERFwLPchaeGhqiDtqZDSt lqAwe2uHEQoS7bNWNU1CuHF6enBAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudefhedgtdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefgfenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepjeefhfegfffgvdeugedv ueeiveetudeuieeiheehfeekvefhfffhveegueeikeetnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Sep 2021 04:25:21 -0400 (EDT) Subject: Re: Support tab completion for upper character inputs in psql To: "tanghy.fnst@fujitsu.com" , Tom Lane , Kyotaro Horiguchi , Laurenz Albe Cc: "smithpb2250@gmail.com" , "david.zhang@highgo.ca" , "pgsql-hackers@lists.postgresql.org" References: <20210423.115812.900808736988307020.horikyota.ntt@gmail.com> From: Peter Eisentraut Message-ID: <80b093ae-88bd-8d8a-68b9-b535a3ab11be@enterprisedb.com> Date: Tue, 7 Sep 2021 10:25:20 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-2022-jp; format=flowed; delsp=yes Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.)