Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5(EOL), 12.0(EOL)
-
None
Description
I run this query intentionally injecting a bad utf8 byte sequence into the query body:
EXECUTE IMMEDIATE REPLACE("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES" |
" WHERE TABLE_NAME LIKE 't20xBEBE'", |
'0xBEBE', 0xBEBE); |
It returns a confusing error:
ERROR 1267 (HY000): Illegal mix of collations (utf8mb3_general_ci,IMPLICIT) and (utf8mb4_uca1400_ai_ci,COERCIBLE) for operation 'like'
|
It's true that the constant cannot be converted to utf8mb3, so utf8mb3_general_ci cannot be used for comparison in LIKE.
However, the error should be raised earlier, even before mixing collations for comparison.
ER_INVALID_CHARACTER_STRING would be fine, like the one raised in this query:
SELECT _utf8mb3 0xBEBE; |
ERROR 1300 (HY000): Invalid utf8mb3 character string: 'BEBE'
|
The misleading error message makes it hard to debug user programs when a user program erroneously added wrong bytes, e.g. using snprintf() or similar function.