Hi!
>>>>> "Alexander" == Alexander Barkov <Alexander> writes:
Alexander> Paul DuBois wrote:
>> I've been puzzling over this patch, which implements a form of the
>> CONVERT() function. I can see that this can be useful for specifying
>> the destination character set as a string expression rather than as
>> an unquoted character set name. But I'm wondering why the second argument
>> is necessary at all. Strings have a charset already, why do you have
>> to specify what it is?
bar> There are some reasons against this style of CONVERT():
bar> CONVERT(string,from_charset,to_charset)
I thought you implemented this function.
bar> They are:
bar> 1. As we lately decided, a function should never return strings
bar> with different charsets in different rows. The above style of
bar> CONVERT() breaks this rule.
<cut>
bar> So, taking all this in account, I can suppose:
bar> 1. we should remove this style: CONVERT(expr,expr,expr), as far
bar> as it can produce strings in different charsets in
bar> different rows, which is wrong;
bar> 2. we can't extend COLLATE to support expression:
bar> SELECT body COLLATE expr
bar> because it will be able to produce different charsets
bar> in different rows again.
bar> Probably, the case is to extend CONVERT syntax to support
bar> something like this:
bar> CONVERT(expr FROM expr USING unquoted_charset_name)
bar> where the first expr is a source string to convert and the
bar> second expr is a source charset. This will not reduce a
bar> functionality and also will not break the rule about
bar> different charsets in rows.
bar> What do you think?
Yes, the above would be ok.
Regards,
Monty
CTO of MySQL AB
| Thread |
|---|
| • bk commit into 4.1 tree | bar | 29 Mar |
| • Re: bk commit into 4.1 tree | Paul DuBois | 29 Mar |
| • Question about CONVERT(str,charset_to,charset_from) | Paul DuBois | 18 Oct |
| • Re: Question about CONVERT(str,charset_to,charset_from) | Peter Zaitsev | 18 Oct |
| • Re: Question about CONVERT(str,charset_to,charset_from) | Paul DuBois | 18 Oct |
| • Re: Question about CONVERT(str,charset_to,charset_from) | Shurik) Barkov | 20 Oct |
| • Re: Question about CONVERT(str,charset_to,charset_from) | Michael Widenius | 20 Oct |
| • Re: Question about CONVERT(str,charset_to,charset_from) | Paul DuBois | 18 Oct |