sets are supersets of ascii  with the exception of swe7 , which reuses some punctuation characters for Swedish accented characters.) 

The use of repertoire enables character set conversion in expressions for many cases where MySQL would otherwise return an “illegal mix of collations”  error when the rules for collation coercibility are insufficient to resolve ambiguities. (For information about coercibility, see Section 10.8.4, “Collation Coercibility in Expressions” .) 

The following discussion provides examples of expressions and their repertoires, and describes how the use of repertoire changes string expression evaluation: 

•The repertoire for a string constant depends on string content and may differ from the repertoire of the string character set. Consider these statements: 

SET NAMES utf8mb4; SELECT ’abc’; SELECT _utf8mb4’def’; 

Although the character set is utf8mb4  in each of the preceding cases, the strings do not actually contain any characters outside the ASCII range, so their repertoire is ASCII  rather than UNICODE . 

•A column having the ascii  character set has ASCII  repertoire because of its character set. In the following table, c1  has ASCII  repertoire: 

CREATE TABLE t1 (c1 CHAR(1) CHARACTER SET ascii); 

The following example illustrates how repertoire enables a result to be determined in a case where an error occurs without repertoire: 

CREATE TABLE t1 ( c1 CHAR(1) CHARACTER SET latin1, c2 CHAR(1) CHARACTER SET ascii ); INSERT INTO t1 VALUES (’a’,’b’); SELECT CONCAT(c1,c2) FROM t1; 

Without repertoire, this error occurs: 

ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (ascii_general_ci,IMPLICIT) for operation ’concat’ 

Using repertoire, subset to superset ( ascii  to latin1 ) conversion can occur and a result is returned: 

+---------------+ | CONCAT(c1,c2) | +---------------+ | ab | +---------------+ 

•Functions with one string argument inherit the repertoire of their argument. The result of UPPER(_utf8mb4’abc’)  has ASCII  repertoire because its argument has ASCII  repertoire. (Despite the _utf8mb4  introducer, the string ’abc’  contains no characters outside the ASCII range.) 

•For functions that return a string but do not have string arguments and use character_set_connection  as the result character set, the result repertoire is ASCII  if character_set_connection  is ascii , and UNICODE  otherwise: 

FORMAT( numeric_column , 4); 

Use of repertoire changes how MySQL evaluates the following example: 

SET NAMES ascii; 

