[MDEV-10749] A syntax to compare string expressions with equal collation derivation Created: 2016-09-06 Updated: 2021-05-11 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Character Sets |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This script:
returns an error
The error is correct:
Therefore, the comparison operator gets two arguments with different collations with the same derivation. Hence, the conflict. It would be nice to have a syntax to resolve conflicts in such cases. An obvious solution would be to use the COLLATE clause:
But if at some point we decide to issue and ALTER TABLE changing the character set or the collation of the column t1.a, similar query will very likely return a wrong result. The intent is to use the collation of the column! Possible solutions:
So the above COLLATE clause does not change the collation of the argument, but changes the collation derivation (making it weaker in this example). This is the full list of the currently supported collation derivation levels:
2. Extend COLLATE clause use any kind of constant string expressions rather than just explicitly typed literal collation names:
|