Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ee8cS-0004Tb-5w for pgsql-general@arkaria.postgresql.org; Wed, 24 Jan 2018 00:08:48 +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 1ee8cR-000360-Oh for pgsql-general@arkaria.postgresql.org; Wed, 24 Jan 2018 00:08:47 +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 1ee8cR-00035r-Av for pgsql-general@lists.postgresql.org; Wed, 24 Jan 2018 00:08:47 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ee8cO-0002Ws-35 for pgsql-general@lists.postgresql.org; Wed, 24 Jan 2018 00:08:46 +0000 Received: by mail-pg0-x242.google.com with SMTP id s9so1424888pgq.13 for ; Tue, 23 Jan 2018 16:08:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ardentperf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=F5cRU72G3IEKRHk5ZDsRkpZL+uqL8zoqA/sySBperRk=; b=heN/UgWI9mQBfNEa5q7MTUIDbgWLTmnAQvV8iqh8GouwR9hTGWNjzKs6+GnVnpxguT T5fJOw6TyHMRk0zuHmW0qknj/vSFTTo7a6VJ9D8M2uxoVke1A4e0GHEWO4+eBS3Jx6yl PfgEYj+5LvClYCWCgnp3aIH3J58JoO36N3dvqhabuNQRP4Cwn5dRCC2SrsdyZeDoNtIb G4Hx4KYPXUzPAaeLPLYY8tOUDauiweWBcVEFS5iDTqTZ7ZOEj9iUr/YBpwYDvqY+wMaQ oK0QRGDJTeqJKc7Kaut3e+RHMU9UPu+XJNX/xE3ctcdWQoZqHdoaT93Du4j95j384XM/ fZmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=F5cRU72G3IEKRHk5ZDsRkpZL+uqL8zoqA/sySBperRk=; b=HPAy+LqSZNGg+k2gDmgdfgc74WhKk3q+8UstT6dfpYdzhKz2jwRFzVTPHnWwyGIFM9 ZlUXy1ZxRjwBdV7Dyz1ZsCLlg4EgZVEYp2dL5C1OjdhUROsA/qX6ZsWtp37sif8In5z8 aRy6p4NHT3Myioh+kI+vE0Vz3SoUiw+7McH9CYgv2YfdC0twgWwypKKXafq6gAFw8szZ MBvSgY8WeLisgjZxC8czbVIdxvX+sTbuaTa0rHXH7JqgXNN+RCeMK3p2KWcQaTo/PMTY LlBndiM8xvj3Izo3tBHyTnoOmbjkzF9JyArc9aWGsaU74Ue28t6wfhUEQl2d1g8aVMcq jPKw== X-Gm-Message-State: AKwxytcm70QsbonWcaqlba2LpSP1gSySACedj0LOHaqwcIpInJ8UlMfx z5yL9gg96msG7ESo3cXPHrNG8XwfY/g= X-Google-Smtp-Source: AH8x2260OHjIBgJSNPlHASvpadMla8o7svRMvY9JsaheuNg+hw84lXPeBm4ToKTdRMQdn1FsY7eiHw== X-Received: by 10.99.182.75 with SMTP id v11mr4865654pgt.158.1516752522172; Tue, 23 Jan 2018 16:08:42 -0800 (PST) Received: from 186590ce269b.ant.amazon.com (54-240-198-34.amazon.com. [54.240.198.34]) by smtp.gmail.com with ESMTPSA id 9sm8405668pfq.62.2018.01.23.16.08.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 16:08:41 -0800 (PST) Subject: Re: Is it possible to sort strings in EBCDIC order in PostgreSQL server? To: pgsql-general@lists.postgresql.org References: <0A3221C70F24FB45833433255569204D1F84A7AD@G01JPEXMBYT05> <0A3221C70F24FB45833433255569204D1F84DD45@G01JPEXMBYT05> From: Jeremy Schneider Message-ID: Date: Tue, 23 Jan 2018 16:08:40 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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