mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-25829 Change default Unicode collation to uca1400_ai_ci
Step#2 - Adding a new collation derivation level for CAST and CONVERT. Now character string cast functions: - CAST(string_expr AS CHAR) - CONVERT(expr USING charset_name) have a new collation derivation level between: - string literals - utf8 metadata functions, e.g. user() and database() Before the change these cast functions had collation derivation equal to table columns, which caused more illegal mix of collation conflicts. Note, binary string cast functions: - BINARY(expr) - CAST(string_expr AS BINARY) - CONVERT(expr USING binary) did not change their collation derivation, to preserve the behaviour of queries like these: SELECT database()=BINARY'test'; SELECT user()=CAST('root' AS BINARY); SELECT current_role()=CONVERT('role' USING binary); Derivation levels after the change look as follows: DERIVATION_IGNORABLE= 7, // Explicit NULL DERIVATION_NUMERIC= 6, // Numbers in string context, // Numeric user variables // CAST(numeric_expr AS CHAR) DERIVATION_COERCIBLE= 5, // Literals, string user variables DERIVATION_CAST= 4, // CAST(string_expr AS CHAR), // CONVERT(string_expr USING cs) DERIVATION_SYSCONST= 3, // utf8 metadata functions, e.g. user(), database() DERIVATION_IMPLICIT= 2, // Table columns, SP variables, BINARY(expr) DERIVATION_NONE= 1, // A mix (e.g. CONCAT) of two differrent collations DERIVATION_EXPLICIT= 0 // An explicit COLLATE clause
This commit is contained in:
@ -485,7 +485,7 @@ where collation(t2.a) = _utf8'binary' order by t1.a,t2.a;
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
|
||||
where charset(t2.a) = _utf8'binary' order by t1.a,t2.a;
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
|
||||
where coercibility(t2.a) = 5 order by t1.a,t2.a;
|
||||
where coercibility(t2.a) = 6 order by t1.a,t2.a;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
@ -2571,3 +2571,32 @@ SELECT CONV(-9223372036854775808, -10, -62);
|
||||
--echo #
|
||||
--echo # End of 11.4 tests
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 11.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-25829 Change default collation to utf8mb4_1400_ai_ci
|
||||
--echo #
|
||||
|
||||
--vertical_results
|
||||
SELECT
|
||||
coercibility(CAST(1 AS CHAR)),
|
||||
coercibility(CONVERT('a' USING latin1));
|
||||
|
||||
SELECT
|
||||
coercibility(CAST(1 AS BINARY)),
|
||||
coercibility(CONVERT('a' USING binary)),
|
||||
coercibility(binary'a');
|
||||
--horizontal_results
|
||||
|
||||
EXPLAIN EXTENDED SELECT
|
||||
CAST(1 AS BINARY) AS c,
|
||||
CONVERT('a' USING binary),
|
||||
BINARY'a';
|
||||
|
||||
--echo #
|
||||
--echo # End of 11.5 tests
|
||||
--echo #
|
||||
|
Reference in New Issue
Block a user