Character set 'binary' cannot be used in conjunction with 'utf8mb4_general_ci' in call to regexp_like

Problem

Release 4.0.6-2 contains update sql-script which will fail on versions of MySQL 8.0.22 or higher

Migration V4.0.39__fix_term_language_code.sql failed ---------------------------------------------------- SQL State : HY000 Error Code : 3995 Message : Character set 'binary' cannot be used in conjunction with 'utf8mb4_general_ci' in call to regexp_like. Location : db/migration/mysql/V4.0.39__fix_term_language_code.sql (/term/product/apache-tomcat-9.0.34/webapps/ROOT/WEB-INF/classes/db/migration/mysql/V4.0.39__fix_term_language_code.sql) Line : 3

Solution

With release of MySQL 8.0.22 has been fixed bug related to our update script:

Regular expression functions such as REGEXP_LIKE() yielded inconsistent results with binary string arguments. These functions now reject binary strings with an error. (Bug #31031886, Bug #98951, Bug #31031888, Bug #98950).
See https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-22.html

  1. To pass through we suggest to run fixed version of migration sql script manually:

    UPDATE `tw_term` AS t, `tw_language` AS l SET t.language_code = l.code3 WHERE CAST(l.code3 AS BINARY) RLIKE BINARY '[A-Z]' AND t.language_code = BINARY LOWER(l.code3) AND t.dictionary_oid = l.dictionary_oid;

     

  2. And mark failed migration in scheme _version as installed successfully, see last paragraph in article https://termweb.atlassian.net/wiki/spaces/TWKB/pages/234618898