1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-35041 Simple comparison causes "Illegal mix of collations" even with default server settings

The task "MDEV-25829 Change default Unicode collation to uca1400_ai_ci"
previously changed collation derivation for string user variables
from DERIVATION_EXPLICIT to DERIVATION_COERCIBLE, to resolve illegal
collation mix conflicts between table columns and user variables
when they have different collations.

However, DERIVATION_COERCIBLE was a wrong choice because it caused
conflicts between string literals and user variables when they have
different collations.

Adding a new collation derivation level DERIVATION_USERVAR.
This makes the collation of a user variable:
- weaker than a table column (like it was intended by MDEV-25829)
- but stronger than a literal (like it was in pre-MDEV-25829)

Cleanup in sql_type.h:
  Removing the line "- BINARY(expr)" from the before-DERIVATION_CAST
  comment, as it was on a wrong place. It's also listed on the correct
  place before DERIVATION_IMPLICIT.
This commit is contained in:
Alexander Barkov
2024-10-22 11:10:58 +04:00
parent 4e1e9ea6f3
commit a88c71b294
31 changed files with 178 additions and 117 deletions

View File

@ -3018,7 +3018,7 @@ static inline my_repertoire_t &operator|=(my_repertoire_t &a,
enum Derivation
{
DERIVATION_IGNORABLE= 7, // Explicit NULL
DERIVATION_IGNORABLE= 8, // Explicit NULL
/*
Explicit or implicit conversion from numeric/temporal data to string:
@ -3026,17 +3026,20 @@ enum Derivation
- Numeric user variables
- CAST(numeric_or_temporal_expr AS CHAR)
*/
DERIVATION_NUMERIC= 6,
DERIVATION_NUMERIC= 7,
/*
- String literals
*/
DERIVATION_COERCIBLE= 6,
/*
- String user variables
*/
DERIVATION_COERCIBLE= 5,
DERIVATION_USERVAR= 5,
/*
String cast and conversion functions:
- BINARY(expr)
- CAST(string_expr AS CHAR)
- CONVERT(expr USING cs)
*/
@ -3162,6 +3165,7 @@ public:
case DERIVATION_NUMERIC: return "NUMERIC";
case DERIVATION_IGNORABLE: return "IGNORABLE";
case DERIVATION_COERCIBLE: return "COERCIBLE";
case DERIVATION_USERVAR: return "USERVAR";
case DERIVATION_CAST: return "CAST";
case DERIVATION_IMPLICIT: return "IMPLICIT";
case DERIVATION_SYSCONST: return "SYSCONST";