pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeremy Schneider <schneider@ardentperf.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Is it possible to sort strings in EBCDIC order in PostgreSQL server?
Date: Tue, 23 Jan 2018 16:08:40 -0800
Message-ID: <d9ca5bf1-dd78-90a9-c7d6-d3d44372e08b@ardentperf.com> (raw)
In-Reply-To: <CAH2-WzmTRsBRx+fvcWsY56ju8YqNxjC7xvhTz6C2F7k_7kpkgw@mail.gmail.com>
References: <0A3221C70F24FB45833433255569204D1F84A7AD@G01JPEXMBYT05>
	<CAH2-Wzkoc3pD3SR=MA=W4FyHFicDypcw2NGUEZDdWbODHiTbKg@mail.gmail.com>
	<0A3221C70F24FB45833433255569204D1F84DD45@G01JPEXMBYT05>
	<CAAJSdjhQf1ajbsZhwtBVhD8sTRKfPQmao-cFL4P2wT1-oncTDw@mail.gmail.com>
	<CAH2-WzmTRsBRx+fvcWsY56ju8YqNxjC7xvhTz6C2F7k_7kpkgw@mail.gmail.com>

On 12/12/17 10:21, Peter Geoghegan wrote:
> ICU supports creating custom collations that reorder upper and lower
> case, or digits with scripts (e.g. Latin alphabet characters). See the
> documentation -- "23.2.2.3.2. ICU collations". Advanced customization
> is possible.

I just gave this a try and I'm not sure I completely understand what
it's doing but it definitely doesn't look like it's sorting according to
EBCDIC byte orders. (This was on centos 7 with libicu-50.1.2) I might
have created the collation incorrectly. I'd love to hear if anyone else
finds a way to get this working outside of custom comparison operators.

pops-10.1 root@db1=# create collation "ebcdic" (provider=icu,
locale='cp037');
CREATE COLLATION

pops-10.1 root@db1=# create table test (data text);
CREATE TABLE

pops-10.1 root@db1=# insert into test
values('a'),('b'),('A'),('B'),('1'),('2'),('!'),('^');
INSERT 0 8

pops-10.1 root@db1=# select * from test order by data collate "ebcdic";
 data
------
 !
 ^
 1
 2
 a
 A
 b
 B
(8 rows)


-- 
http://about.me/jeremy_schneider




view thread (15+ messages)

Message-ID: <d9ca5bf1-dd78-90a9-c7d6-d3d44372e08b@ardentperf.com>
Permalink:  ../d9ca5bf1-dd78-90a9-c7d6-d3d44372e08b@ardentperf.com/
Also on:    postgresql.org/message-id/d9ca5bf1-dd78-90a9-c7d6-d3d44372e08b@ardentperf.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: schneider@ardentperf.com
  Subject: Re: Is it possible to sort strings in EBCDIC order in PostgreSQL server?
  In-Reply-To: <d9ca5bf1-dd78-90a9-c7d6-d3d44372e08b@ardentperf.com>
  References: <0A3221C70F24FB45833433255569204D1F84A7AD@G01JPEXMBYT05> <CAH2-Wzkoc3pD3SR=MA=W4FyHFicDypcw2NGUEZDdWbODHiTbKg@mail.gmail.com> <0A3221C70F24FB45833433255569204D1F84DD45@G01JPEXMBYT05> <CAAJSdjhQf1ajbsZhwtBVhD8sTRKfPQmao-cFL4P2wT1-oncTDw@mail.gmail.com> <CAH2-WzmTRsBRx+fvcWsY56ju8YqNxjC7xvhTz6C2F7k_7kpkgw@mail.gmail.com> <d9ca5bf1-dd78-90a9-c7d6-d3d44372e08b@ardentperf.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox