question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

init_replica: ERROR 1270 (HY000): Illegal mix of collations

See original GitHub issue

We got the following table:

 CREATE TABLE `channel_attributes` (
  `channel_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `attribute_id` bigint(20) NOT NULL,
  `value` varchar(500) CHARACTER SET utf8 NOT NULL DEFAULT 'true',
  PRIMARY KEY (`channel_id`,`attribute_id`),
  KEY `attribute_id` (`attribute_id`),
  CONSTRAINT `channel_attributes_ibfk_2` FOREIGN KEY (`attribute_id`) REFERENCES `channel_attributes_domain` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

This table produces the following issue when running init_replica:

Jul 17 09:46:49: [INFO] - mysql_lib.py (612): copying table channel_attributes
Jul 17 09:46:49: [DEBUG] - mysql_lib.py (615): estimating rows in channel_attributes
Jul 17 09:46:49: [DEBUG] - mysql_lib.py (644): channel_attributes will be copied in 1 slices of 3054105 rows
Jul 17 09:46:49: [DEBUG] - mysql_lib.py (651): Executing query for table channel_attributes
Jul 17 09:46:49: [ERROR] - mysql_lib.py (654): error when pulling data from channel_attributes. sql executed: SELECT REPLACE(CONCAT('"',CONCAT_WS('","',COALESCE(REPLACE(`channel_id`, '"', '""'),'NULL') ,COALESCE(REPLACE(`attribute_id`, '"', '""'),'NULL') ,COALESCE(REPLACE(`value`, '"', '""'),'NULL') ),'"'),'"NULL"','NULL') as data FROM channel_attributes;
Jul 17 09:46:49: [DEBUG] - mysql_lib.py (656): Starting extraction loop for table channel_attributes
Jul 17 09:46:49: [INFO] - mysql_lib.py (692): the table channel_attributes does not exist

running the sql manually shows the following extra error:

mysql> SELECT REPLACE(CONCAT('"',CONCAT_WS('","',COALESCE(REPLACE(`channel_id`, '"', '""'),'NULL') ,COALESCE(REPLACE(`attribute_id`, '"', '""'),'NULL') ,COALESCE(REPLACE(`value`, '"', '""'),'NULL') ),'"'),'"NULL"','NULL') as data FROM channel_attributes;
ERROR 1270 (HY000): Illegal mix of collations (utf8_bin,NONE), (utf8_general_ci,COERCIBLE), (utf8_general_ci,COERCIBLE) for operation 'replace'

The issue is primarily with the value column - removing it from the sql and it works.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Jul 17, 2017

running tests right now

0reactions
the4thdoctorcommented, Jul 17, 2017

thank you for the quick feedback 😃 I’ll release the patched version at last by Saturday 22nd. I need to sort out the default value DDL replica first.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR 1270 (HY000): Illegal mix of collations
Description: First query execution within a connection is successfull. All another (for the same query) fails with error message "ERROR 1270 ...
Read more >
Troubleshooting "Illegal mix of collations" error in mysql
This is generally caused by comparing two strings of incompatible collation or by attempting to select data of different collation into a combined...
Read more >
Illegal mix of collations error in MySQL - utf8_unicode_ci ...
This is generally caused by comparing two strings of incompatible collations or by attempting to select data of different collations into a ...
Read more >
MySQL - Fixing an Illegal mix of Collation
While creating an ETL process for a Client, I ran into the following MySQL error: "Illegal mix of collations (latin1_swedish_ci,IMPLICIT)
Read more >
MySQL dump error 'illegal mix of collations' - How to resolve
MySQL dump error 'illegal mix of collations' : It occurs by comparing two strings of incompatible collations. We need to make the two ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found