From: | Matheus de Oliveira <matioli(dot)matheus(at)gmail(dot)com> |
---|---|
To: | Silvio Brandani <silvio(dot)brandani(at)tech(dot)sdb(dot)it> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: order by query wrong result |
Date: | 2014-11-19 20:07:21 |
Message-ID: | CAJghg4KGCAKJn=APRbT6odp82NMg4FoUp7_MYxpz5hzx53xyGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Wed, Nov 19, 2014 at 2:36 PM, Silvio Brandani <
silvio(dot)brandani(at)tech(dot)sdb(dot)it> wrote:
> 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));
>
If you are trying to get smarter than the collate, don't you think it would
be a good idea to use C collate?
e.g. ORDER BY upper(name) COLLATE "C";
You can even use a cleanup like to convert things that you want to consider
the same (as using unaccent). Although it would make harder to move with
and without accent to the same place.
Regards,
--
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres
From | Date | Subject | |
---|---|---|---|
Next Message | Silvio Brandani | 2014-11-21 09:28:02 | Re: order by query wrong result |
Previous Message | Silvio Brandani | 2014-11-19 16:36:53 | Re: order by query wrong result |