Client-side merge & string sorting

Поиск
Список
Период
Сортировка
От Daniele Orlandi
Тема Client-side merge & string sorting
Дата
Msg-id 3DA724CF.80201@orlandi.com
обсуждение исходный текст
Список pgsql-hackers
Hello,

I sometimes need to perform client-side merges, sometimes between two 
tables on the same database, sometimes between two different databases.

When the merge key is numeric all goes well but, when the merge key is a 
string a problem arises: string comparison operators often behave 
differently between the database(s) and the client's language.

Sometimes it is due to the locale settings, sometimes is the particular 
implementation of the operator, as a matter of facts, I cannot trust the 
strings comparison operators.

Si, the question is how client-side merge should be done...

- Perform the sorting locally... only one operator... maybe suboptimal 
sorting... etc....

- Compare the strings hex-encoded: overhead apart, I found myself unable 
to use encode(..) function on PostgreSQL since it accepts only BYTEA 
data and text isn't castable to bytea.

- Invent a new operator whose behaviour would be always consistent, 
locale-indepentent... (like the very-first C's strcmp).

Which do you think should be the correct approach ?

Thanks in advance!
Best regards!

--  Daniele Orlandi Planet Srl



В списке pgsql-hackers по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: Peer to peer replication of Postgresql databases
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: MySQL vs PostgreSQL.