|
Hi,
all seems right. I don't understand how this can occur.
can you send the result of this following queries, to help identify to problem ?
select * from information_schema.collations
where id in ( 45, 46, 224, 225, 226, 227, 228,229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 245, 246, 247)
order by id;
select @@session.collation_connection, @@global.collation_connection,
@@session.collation_database, @@global.collation_database,
@@session.collation_server, @@global.collation_server,
@@session.character_set_client, @@global.character_set_client,
@@session.character_set_connection, @@global.character_set_connection,
@@session.character_set_database, @@global.character_set_database,
@@session.character_set_server, @@global.character_set_server,
@@global.character_set_system;
SELECT default_character_set_name FROM information_schema.SCHEMATA
WHERE schema_name = "<The default schema used>";
because, it's seems, server is configured as binary, not utf8mb4, but driver normally change binary to utf8 in this case...but this doesn't correspond to your error.
|
|
I'm glad to help. I checked the server config and there is no 'binary' to be found. Here is the output:
select * from information_schema.collations
|
-> where id in ( 45, 46, 224, 225, 226, 227, 228,229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 245, 246, 247)
|
-> order by id;
|
+------------------------------+--------------------+-----+------------+-------------+---------+
|
| COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN |
|
+------------------------------+--------------------+-----+------------+-------------+---------+
|
| utf8mb4_general_ci | utf8mb4 | 45 | Yes | Yes | 1 |
|
| utf8mb4_bin | utf8mb4 | 46 | | Yes | 1 |
|
| utf8mb4_unicode_ci | utf8mb4 | 224 | | Yes | 8 |
|
| utf8mb4_icelandic_ci | utf8mb4 | 225 | | Yes | 8 |
|
| utf8mb4_latvian_ci | utf8mb4 | 226 | | Yes | 8 |
|
| utf8mb4_romanian_ci | utf8mb4 | 227 | | Yes | 8 |
|
| utf8mb4_slovenian_ci | utf8mb4 | 228 | | Yes | 8 |
|
| utf8mb4_polish_ci | utf8mb4 | 229 | | Yes | 8 |
|
| utf8mb4_estonian_ci | utf8mb4 | 230 | | Yes | 8 |
|
| utf8mb4_spanish_ci | utf8mb4 | 231 | | Yes | 8 |
|
| utf8mb4_swedish_ci | utf8mb4 | 232 | | Yes | 8 |
|
| utf8mb4_turkish_ci | utf8mb4 | 233 | | Yes | 8 |
|
| utf8mb4_czech_ci | utf8mb4 | 234 | | Yes | 8 |
|
| utf8mb4_danish_ci | utf8mb4 | 235 | | Yes | 8 |
|
| utf8mb4_lithuanian_ci | utf8mb4 | 236 | | Yes | 8 |
|
| utf8mb4_slovak_ci | utf8mb4 | 237 | | Yes | 8 |
|
| utf8mb4_spanish2_ci | utf8mb4 | 238 | | Yes | 8 |
|
| utf8mb4_roman_ci | utf8mb4 | 239 | | Yes | 8 |
|
| utf8mb4_persian_ci | utf8mb4 | 240 | | Yes | 8 |
|
| utf8mb4_esperanto_ci | utf8mb4 | 241 | | Yes | 8 |
|
| utf8mb4_hungarian_ci | utf8mb4 | 242 | | Yes | 8 |
|
| utf8mb4_sinhala_ci | utf8mb4 | 243 | | Yes | 8 |
|
| utf8mb4_croatian_mysql561_ci | utf8mb4 | 245 | | Yes | 8 |
|
| utf8mb4_unicode_520_ci | utf8mb4 | 246 | | Yes | 8 |
|
| utf8mb4_vietnamese_ci | utf8mb4 | 247 | | Yes | 8 |
|
+------------------------------+--------------------+-----+------------+-------------+---------+
|
25 rows in set (0.00 sec)
|
select @@session.collation_connection, @@global.collation_connection,
|
-> @@session.collation_database, @@global.collation_database,
|
-> @@session.collation_server, @@global.collation_server,
|
-> @@session.character_set_client, @@global.character_set_client,
|
-> @@session.character_set_connection, @@global.character_set_connection,
|
-> @@session.character_set_database, @@global.character_set_database,
|
-> @@session.character_set_server, @@global.character_set_server,
|
-> @@global.character_set_system;
|
+--------------------------------+-------------------------------+------------------------------+-----------------------------+----------------------------+---------------------------+--------------------------------+-------------------------------+------------------------------------+-----------------------------------+----------------------------------+---------------------------------+--------------------------------+-------------------------------+-------------------------------+
|
| @@session.collation_connection | @@global.collation_connection | @@session.collation_database | @@global.collation_database | @@session.collation_server | @@global.collation_server | @@session.character_set_client | @@global.character_set_client | @@session.character_set_connection | @@global.character_set_connection | @@session.character_set_database | @@global.character_set_database | @@session.character_set_server | @@global.character_set_server | @@global.character_set_system |
|
+--------------------------------+-------------------------------+------------------------------+-----------------------------+----------------------------+---------------------------+--------------------------------+-------------------------------+------------------------------------+-----------------------------------+----------------------------------+---------------------------------+--------------------------------+-------------------------------+-------------------------------+
|
| utf8mb4_general_ci | utf8mb4_general_ci | utf8mb4_general_ci | utf8mb4_general_ci | utf8mb4_general_ci | utf8mb4_general_ci | utf8mb4 | utf8mb4 | utf8mb4 | utf8mb4 | utf8mb4 | utf8mb4 | utf8mb4 | utf8mb4 | utf8 |
|
+--------------------------------+-------------------------------+------------------------------+-----------------------------+----------------------------+---------------------------+--------------------------------+-------------------------------+------------------------------------+-----------------------------------+----------------------------------+---------------------------------+--------------------------------+-------------------------------+-------------------------------+
|
1 row in set (0.00 sec)
|
SELECT default_character_set_name FROM information_schema.SCHEMATA
|
-> WHERE schema_name = "wd_db";
|
+----------------------------+
|
| default_character_set_name |
|
+----------------------------+
|
| utf8mb4 |
|
+----------------------------+
|
1 row in set (0.00 sec)
|
|
|
Thanks for the test case, it has permit to identify the problem !
Problem is the use of "COLLATE" keywork in PREPARE statement :
CREATE TABLE IF NOT EXISTS `tt` (
`test` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
#Text work well
SELECT * FROM `tt` WHERE `test` LIKE 'jj' COLLATE utf8mb4_unicode_ci
#will throw an error "Erreur SQL (1253) : COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'binary'"
PREPARE stmt FROM 'SELECT * FROM `tt` WHERE `test` LIKE ? COLLATE utf8mb4_unicode_ci'
I'll create a server issue about this problem.
Second is on driver side : to use text query as a fallback to fail prepare.
Diego.
|