1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-24 19:42:23 +03:00

MDEV-25829 Change default Unicode collation to uca1400_ai_ci

Step#1 - Changing collation derivation for string user variables
from IMPLICIT to COERCIBLE.

Retionale:

Without this preparatory change, switching the default collation for
Unicode character sets from xxx_general_ci to uca1400_ai_ci would cause
"Illegal mix of collations" errors in scenarios comparing a column with
a non-default collation to a string user variable

This is especially important for queries to INFORMATION_SCHEMA tables,
whose columns use utf8mb3_general_ci.

See the description of MDEV-25829 for more details and SQL script examples.
This commit is contained in:
Alexander Barkov
2023-11-15 06:09:41 +04:00
parent 44974a0788
commit 1b65cc9da7
5 changed files with 33 additions and 16 deletions

View File

@ -428,7 +428,13 @@ SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this a
--echo # Testing a warning
SET NAMES latin1;
SET @regCheck= '\\xE0\\x01';
SELECT 0xE001 REGEXP @regCheck;
SELECT 0xE001 REGEXP @regCheck COLLATE latin1_bin;
SELECT 0xE001 REGEXP CAST(@regCheck AS CHAR);
--echo # Since 11.4 user variables have DERIVATION_COERCIBLE
--echo # so a user variable and a literal in the pattern give equal results
SET @regCheck= '\\xE0\\x01';
SELECT 0xE001 REGEXP '\\xE0\\x01' AS c1, 0xE001 REGEXP @regCheck AS c2;
--echo # Testing workaround N1: This makes the pattern to be a binary string:
SET NAMES latin1;