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 1pOpE1-0007w6-UU for pgsql-general@arkaria.postgresql.org; Mon, 06 Feb 2023 00:19:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pOpDz-0001j2-Fx for pgsql-general@arkaria.postgresql.org; Mon, 06 Feb 2023 00:19:11 +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 1pOpDz-0001ir-4z for pgsql-general@lists.postgresql.org; Mon, 06 Feb 2023 00:19:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOpDs-0001Mm-88 for pgsql-general@lists.postgresql.org; Mon, 06 Feb 2023 00:19:10 +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 3160J1PL2556581; Sun, 5 Feb 2023 19:19:01 -0500 From: Tom Lane To: Dionisis Kontominas cc: pgsql-general@lists.postgresql.org Subject: Re: Question regarding UTF-8 data and "C" collation on definition of field of table In-reply-to: References: <2550995.1675639480@sss.pgh.pa.us> Comments: In-reply-to Dionisis Kontominas message dated "Mon, 06 Feb 2023 00:36:54 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2556579.1675642741.1@sss.pgh.pa.us> Date: Sun, 05 Feb 2023 19:19:01 -0500 Message-ID: <2556580.1675642741@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dionisis Kontominas writes: > I suppose that affects the outcome of ORDER BY clauses on the field, > along with the content of the indexes. Is this right? Yeah. > Assuming that the requirement exists, to store UTF-8 characters on a > field that can be from multiple languages, and the database default > encoding is UTF8 which is the right thing I suppose (please verify), what > do you think should be the values of the Collation and Ctype for the > database to behave correctly? Um ... so define "correct". If you have a mishmash of languages in the same column, it's likely that they have conflicting rules about sorting, and there may be no ordering that's not surprising to somebody. If there's a predominant language in the data, selecting a collation matching that seems like your best bet. Otherwise, maybe you should just shrug your shoulders and stick with C collation. It's likely to be faster than any alternative. regards, tom lane