Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAMyY-006KHj-IT for pgsql-sql@arkaria.postgresql.org; Tue, 05 Dec 2023 04:24:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rAMyX-002Ch7-0m for pgsql-sql@arkaria.postgresql.org; Tue, 05 Dec 2023 04:24:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAMyW-002CgZ-O0 for pgsql-sql@lists.postgresql.org; Tue, 05 Dec 2023 04:24:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAMyT-008rIz-Pd for pgsql-sql@lists.postgresql.org; Tue, 05 Dec 2023 04:23:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3B54Ntwu848537; Mon, 4 Dec 2023 23:23:55 -0500 From: Tom Lane To: Steve Midgley cc: Bo Guo , Greg Sabino Mullane , pgsql-sql Subject: Re: Overcoming Initcap Function limitations? In-reply-to: References: Comments: In-reply-to Steve Midgley message dated "Mon, 04 Dec 2023 20:12:34 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <848535.1701750235.1@sss.pgh.pa.us> Date: Mon, 04 Dec 2023 23:23:55 -0500 Message-ID: <848536.1701750235@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Steve Midgley writes: > On Mon, Dec 4, 2023, 5:39 PM Bo Guo wrote: >> Your suggestions open up new potentials for me to explore. At this >> moment, I lean towards normalizing the database column values in upper >> case, thereby out-sourcing the case-changing responsibility to the front >> end. I would love to hear from your thoughts on this pattern. > It really depends on the use case. If your users are happy with all > uppercase, that seems like a great solution: fast, cheap, and reliable! FWIW, as an old database geek I'd lean more towards "store the original input data". If you are expecting the client-side display code to transform the casing anyway, I don't see any advantage in smashing to upper case beforehand. And keeping the original casing could have value down the road, if only for forensic purposes. regards, tom lane