On Sun, Dec 10, 2017 at 11:09 PM, Tsunakawa, Takayuki <tsunakawa.ta...@jp.fujitsu.com> wrote: > 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.
There is no need for embarrassment. I think that you mean that you'd like to get behavior equivalent to the "C" locale with an EBCDIC encoding. Right? I think that you could use ICU to do this with some work. ICU collations are not tied to a particular encoding, unlike the libc collations (they support most but not all collations). That said, the idea of an "EBCDIC collation" seems limiting. Why should a system like DB2 for the mainframe (that happens to use EBCDIC as its encoding) not have a more natural, human-orientated collation even while using EBCDIC? ISTM that the point of using the "C" locale (with EBDIC or with UTF-8 or with any other encoding) is to get a performance benefit where the actual collation's behavior doesn't matter much to users. Are you sure it's really important to be *exactly* compatible with EBCDIC order? As long as you're paying for a custom collation, why not just use a collation that is helpful to humans? -- Peter Geoghegan