Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOPLg-0007yY-W1 for pgsql-general@arkaria.postgresql.org; Mon, 11 Dec 2017 14:46:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOPLf-0003LH-Vy for pgsql-general@arkaria.postgresql.org; Mon, 11 Dec 2017 14:46:27 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eOPLf-0003L7-LP for pgsql-general@lists.postgresql.org; Mon, 11 Dec 2017 14:46:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eOPLc-0006VJ-Qw for pgsql-general@postgresql.org; Mon, 11 Dec 2017 14:46:26 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vBBEkJRu022977; Mon, 11 Dec 2017 09:46:19 -0500 From: Tom Lane To: "Tsunakawa, Takayuki" cc: "pgsql-general@postgresql.org" Subject: Re: Is it possible to sort strings in EBCDIC order in PostgreSQL server? In-reply-to: <0A3221C70F24FB45833433255569204D1F84A7AD@G01JPEXMBYT05> References: <0A3221C70F24FB45833433255569204D1F84A7AD@G01JPEXMBYT05> Comments: In-reply-to "Tsunakawa, Takayuki" message dated "Mon, 11 Dec 2017 07:09:41 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22975.1513003579.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 11 Dec 2017 09:46:19 -0500 Message-ID: <22976.1513003579@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Tsunakawa, Takayuki" writes: > It is embarrassing to ask such a thing, but is there any way to sort cha= racter column values in EBCDIC order inside the PostgreSQL server? i.e. i= s it possible to use EBCDIC collation in PostgreSQL, say, by using ICU or = something? We need to run on a certain mainframe. > I see almost no hope from the following, but let me make sure. > https://www.postgresql.org/message-id/flat/28548.1424884373%40sss.pgh.pa= .us#28548.1424884373@sss.pgh.pa.us > "Hmm ... EBCDIC ... is that mandatory? Because there are a pretty large > number of ASCII dependencies in PG, mostly arising from our support of > multibyte character sets, which are all expected to be ASCII supersets. > If there's not a way to run the server process in ASCII-land, you're > likely dead in the water. I would not want to try to ferret out all > the dependencies." As I recall, that question was about converting the server to use EBCDIC strings everywhere. That seems impractical for the reasons I mentioned. But you could probably sort according to EBCDIC order if you were willing to accept some inefficiency: internal to the comparison function, convert each string to EBCDIC on each call. Another way you could imagine is to store EBCDIC strings embedded in bytea values. regards, tom lane