Re: order by query wrong result
От | Matheus de Oliveira |
---|---|
Тема | Re: order by query wrong result |
Дата | |
Msg-id | CAJghg4KGCAKJn=APRbT6odp82NMg4FoUp7_MYxpz5hzx53xyGg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: order by query wrong result (Silvio Brandani <silvio.brandani@tech.sdb.it>) |
Ответы |
Re: order by query wrong result
|
Список | pgsql-admin |
On Wed, Nov 19, 2014 at 2:36 PM, Silvio Brandani <silvio.brandani@tech.sdb.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.
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
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres
В списке pgsql-admin по дате отправления: