Re: Is it possible to sort strings in EBCDIC order in PostgreSQL server?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is it possible to sort strings in EBCDIC order in PostgreSQL server?
Date: 2017-12-11 14:46:19
Message-ID: 22976.1513003579@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com> writes:
> It is embarrassing to ask such a thing, but is there any way to sort character column values in EBCDIC order inside the PostgreSQL server? i.e. is 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(dot)1424884373%40sss(dot)pgh(dot)pa(dot)us#28548(dot)1424884373(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-12-11 15:04:37 Re: Removing INNER JOINs
Previous Message Ray Stell 2017-12-11 14:43:48 PostgreSQL is so hip again