Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 882EE156C84C for ; Wed, 16 May 2012 16:21:12 -0300 (ADT) Received: from 30.55.colo.spiretech.net ([69.168.55.30] helo=lists.commandprompt.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SUjmS-00057a-6U for pgsql-bugs@postgresql.org; Wed, 16 May 2012 19:21:11 +0000 Received: from perhan.alvh.no-ip.org (spinlock.commandprompt.com [69.168.55.30]) by lists.commandprompt.com (Postfix) with ESMTPA id 5140BED; Wed, 16 May 2012 12:20:48 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.10.164] helo=perhan.alvh.no-ip.org) by assp.commandprompt.com with ESMTPS(AES256-SHA) (2.1.1); 16 May 2012 12:20:45 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7CAD16E450; Wed, 16 May 2012 15:20:44 -0400 (CLT) Content-Type: text/plain; charset=UTF-8 Cc: Pg Bugs Subject: Re: BUG #6642: Spanish collation fault From: Alvaro Herrera To: tulio.carrasco In-reply-to: References: Date: Wed, 16 May 2012 15:20:44 -0400 Message-Id: <1337195790-sup-2177@alvh.no-ip.org> User-Agent: Sup/git X-Assp-Version: 2.1.1(11364) on assp.commandprompt.com X-Assp-Client-TLS: yes X-Assp-ID: assp.commandprompt.com m1-96048-05265 X-Assp-Envelope-From: alvherre@alvh.no-ip.org X-Assp-Intended-For: tulio.carrasco@gmail.com X-Assp-Original-Subject: Re: [BUGS] BUG #6642: Spanish collation fault Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/100 X-Sequence-Number: 33071 Excerpts from tulio.carrasco's message of mar may 15 21:45:00 -0400 2012: > In Spanish every vowel has the same precedence value even with or witho= ut > any type of accent, so: a =3D =C3=A1 =3D =C3=A4 =3D A =3D =C3=81 =3D =C3= =84 > In which due dad column has the same value it uses the mum column and i= f > they also have the same value then it should use the name column. I see your point, and it makes sense, but it just doesn't work that way. The way it works is that it goes over the first column and does the two passes (first ignoring accents, second considering them) over it using the collating rules you describe; and once that is complete, it goes to look at the second column. I don't think it's possible at all to implement what you suggest, which is to make the first pass over all the columns and then the second pass over all the columns. I didn't try, but if you were to do an ORDER BY dad || ' ' || mum ' ' || = name I think it should do what you want. (Not really sure the spaces are necessary). Because then you're sorting on a single string and it can do the first pass on the whole thing and then the second pass. --=20 =C3=81lvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support