[MDEV-21815] Incorrect character set / collation for user variables Created: 2020-02-25 Updated: 2020-07-22 Resolved: 2020-06-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Character Sets, Variables |
| Affects Version/s: | 10.5.1, 10.5 |
| Fix Version/s: | 10.5.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Todd Michael | Assignee: | Alexander Barkov |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | Compatibility, regression | ||
| Environment: |
Windows 10 Pro 64 bit |
||
| Issue Links: |
|
||||||||
| Description |
|
The values of this query differs from MariaDB 10.3 and MariaDB 10.4. MariaDB 10.5 initially casts these user variables as latin1 instead of the server character set or collation. This leads to errors like "Error Code: 1267. Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'if'" when attempting to use such user variables in subsequent comparisons and calculations, which otherwise work perfectly on MariaDB 10.3 and MariaDB 10.4.
|
| Comments |
| Comment by Elena Stepanova [ 2020-03-08 ] | |||||
|
Thanks for the report. The change happened with this commit:
I'll leave it to bar to determine whether the described effect was intentional or not. | |||||
| Comment by Alexander Barkov [ 2020-06-11 ] | |||||
|
This change was intentional. Please report (as a separate issue) the exact SQL script which worked before 10.5.2 and started to return Illegal mix in 10.5.2. Note, using functions charset() and collation() is not reliable in this context. There are two types of charset/collation of an expression. In case of numeric data, the character set for the protocol is binary, while the character set for aggregation is latin1.
return an expression of the session default character set and collation (rather than a binary expression). Note, functions CHARSET() and COLLATION() return #1, i.e. the protocol attributes. So the above script is not much useful to find the reason of Illegal mix. Also, CHARSET() and COLLATION() do not calculate its argument, so assignments unside:
do not really happen as of 10.5.2 | |||||
| Comment by Todd Michael [ 2020-07-21 ] | |||||
|
POSTSCRIPT: Followed up at MDEV-23246. |