HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_turkish_ci,IMPLICIT) for operation '=' and why?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
mixillegalutf8_unicode_ciwhyimplicitcollationsoperationforandutf8_turkish_ci

Problem

Hello I got error in mariadb. In my command two columns have different collate. one is utf8_unicode_ci (a) other is utf8_turkish_ci (b). Why I got error when I compare these columns ( where a = b ) both of them utf8.
Error:
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_turkish_ci,IMPLICIT) for operation '='

Solution

It would be useful if you can provide your tables definition. However, your error suggests that your are trying to check equality between two columns having different collation.

One solution is to change collation of one of the columns to match the other collation. Check here - Column Level.

Other solution is to use COLLATE clause (I do not know if this works in mariadb, but it should be there).

Personally, I prefer to avoid COLLATE and harmonize string columns as collation mismatch tend to force lots of COLLATEs (maintenance problems).

Context

StackExchange Database Administrators Q#124559, answer score: 3

Revisions (0)

No revisions yet.