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