Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xr8FX-00089D-Vy for pgsql-admin@arkaria.postgresql.org; Wed, 19 Nov 2014 16:37:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xr8FX-0002Sg-Bk for pgsql-admin@arkaria.postgresql.org; Wed, 19 Nov 2014 16:36:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xr8FW-0002SZ-At for pgsql-admin@postgresql.org; Wed, 19 Nov 2014 16:36:58 +0000 Received: from mail2.sdb.it ([85.37.147.67]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xr8FS-0002Rx-GC for pgsql-admin@postgresql.org; Wed, 19 Nov 2014 16:36:57 +0000 Received: by mail2.sdb.it (Postfix, from userid 501) id 1ACC320089; Wed, 19 Nov 2014 17:36:54 +0100 (CET) Received: from geronimo.sdb.it (sdbfi-mh.sdb.it [10.101.1.20]) by mail2.sdb.it (Postfix) with ESMTP id 043B020076; Wed, 19 Nov 2014 17:36:54 +0100 (CET) Received: from mailtech.sdb.it (localhost.localdomain [127.0.0.1]) by geronimo.sdb.it (Postfix) with ESMTP id 002AAD8002; Wed, 19 Nov 2014 17:36:54 +0100 (CET) Received: from [127.0.0.1] (pcsilviob2.sdb.it [10.118.101.111]) by mailtech.sdb.it (Postfix) with ESMTPA id 010108EE; Wed, 19 Nov 2014 17:36:54 +0100 (CET) Message-ID: <546CC725.7000805@tech.sdb.it> Date: Wed, 19 Nov 2014 17:36:53 +0100 From: Silvio Brandani User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Tom Lane CC: Albe Laurenz , "pgsql-admin@postgresql.org" Subject: Re: order by query wrong result References: <546CA188.705@tech.sdb.it> <546CBDF1.2030007@tech.sdb.it> <27275.1416413426@sss.pgh.pa.us> In-Reply-To: <27275.1416413426@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Private-Material: Please read notice X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Hi, I find this workaround: CREATE OR REPLACE FUNCTION cleanup(text) RETURNS text AS $$ SELECT replace(replace(replace($1, ' ','x'),'-','x'),'.','x') $$ LANGUAGE sql; and I get correct result : select name from prva where name ilike 'savino del bene s%' order by upper(cleanup(name)); Silvio Brandani -- Il 19/11/2014 17:10, Tom Lane ha scritto: > Silvio Brandani writes: >> Hi, >> lc_collate >> ------------- >> en_US.UTF-8 > en_US (and, in fact, most Linux locales other than C) uses "dictionary > order", which ignores pretty much everything except letters in its > first-pass comparison. > > You can check that it's not just Postgres being weird by feeding the > same data through sort(1) after setting LC_COLLATE this way in its > environment. You'll get the same results. > > regards, tom lane > -------------------------------------------------------------------------------- This message is for the recipients only. If you receive it in error, please notify the sender and delete it together with any attachments. For any further information, including our privacy policy please refer to http://www.savinodelbene.com/privacy/ -------------------------------------------------------------------------------- -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin