Mariadb – Collation conflicts between views and functions when using utf8mb4_unicode_ci collation

functionsmariadbview

Currently running MariaDB 10.3.24 and I really want to fully support the utf8mb4 unicode character set in my databases.

The problem I am running into is that when I try and set everything up to use the utf8mb4 character set and set all collation references to utf8mb4_unicode_ci I then have problems with views that have functions in them …. getting "collation mismatch" error on some but not all comparisons, e.g. this != that or this = that, etc. If I then set all the collation references back to utf8mb4_general_ci then all is fine ….. Is there something that I am doing wrong or is there some sort of work around that I have to do when creating views and functions when using the utf8mb4_unicode_ci collation ….

Thanks

Best Answer

Before defining Stored Routines, etc, establish the desired CHARACTER SET and COLLATION. One way to do that is via SET NAMES.

Also check

SHOW CREATE DATABASE

utf8mb4_unicode_520_ci is newer than utf8mb4_unicode_ci. (I don't know what collation changes were made by Unicode between their 4.0.0 and 5.2.0 versions. You may never notice a difference.)