Conversion Questions

Started by Peter Eisentrautover 23 years ago2 messages
#1Peter Eisentraut
peter_e@gmx.net

Is there ever a need to have more than one conversion for a given
combination of encodings? And if I have more than one combination
registered, which one is used by the implicit server/client conversion?

Also, if my server encoding is A and my client encoding is B, and I do

SELECT convert('some string' using a_to_c); -- not B

or even

SELECT convert('some string' using e_to_f);

this would surely lead to bogus results? What's the use of all this?

--
Peter Eisentraut peter_e@gmx.net

#2Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Peter Eisentraut (#1)
Re: Conversion Questions

Is there ever a need to have more than one conversion for a given
combination of encodings?

Sure. For example, several Unicode and SJIS mappings exist depending
on vendors or standards. M$ has its own, Apple has another one...
If a user want to employ Apple's map, he could define his own implicit
conversion.

And if I have more than one combination
registered, which one is used by the implicit server/client conversion?

That depends on current name space. You could find such an example in
the conversion regression test. Note that you cannot define more than
one implicit conversion for a schema/server encoding/client encoding
combination.

Also, if my server encoding is A and my client encoding is B, and I do

SELECT convert('some string' using a_to_c); -- not B

or even

SELECT convert('some string' using e_to_f);

this would surely lead to bogus results?

Yes. Choosing right conversion is callers responsibilty.

What's the use of all this?

One example. A user wants to apply lower() to Unicode database.

select convert(lower(convert('X' using utf_8_to_iso_8859_1)) using iso_8859_1_to_utf_8);
--
Tatsuo Ishii