Recently, the project migrated to MySQL, after the migration is complete, when the user permissions are generated an exception, tracked in to get the execution of the statement as follows,
SELECTPermissionID fromSpysxtpermissionWHERE(resourcecategory= 'Baseuser' andResourceId= '003bf4bd072243fa90517ee2bc088cb7' andEnabled= 1 andDeletionstatecode= 0)UNION SELECTPermissionID fromSpysxtpermission, (SELECTRoleid fromSpysxtuserroleWHERE(UserId= '003bf4bd072243fa90517ee2bc088cb7' andEnabled= 1 andDeletionstatecode= 0)UNION SELECTRoleid fromBaseuserroleWHERE(UserId= '003bf4bd072243fa90517ee2bc088cb7' andEnabled= 1 andDeletionstatecode= 0)) BWHEREResourcecategory= 'Spysxtrole' andSpysxtpermission.resourceid=B.roleid andSpysxtpermission.enabled= 1 andSpysxtpermission.deletionstatecode= 0
In navicate execution, the following prompts:
This statement is performed in Oracle is normal, for a moment do not know what reason, Baidu did not find how to deal with, I will open the statement one by one execution, finally found the problem here:
SELECTRoleid fromSpysxtuserroleWHERE(UserId= '003bf4bd072243fa90517ee2bc088cb7' andEnabled= 1 andDeletionstatecode= 0)
UNION SELECTRoleid fromBaseuserroleWHERE(UserId= '003bf4bd072243fa90517ee2bc088cb7' andEnabled= 1 andDeletionstatecode= 0)
Seeing here, it occurred to me that there might be a different character set created, open the table
The original problem is in the collation, one is Utf8_unicode_ci, one is utf8_danish_ci. Change all to Utf8_unicode_ci. Problem Solving!
Originally thought is the code bug, has been debugging the code, did not think the problem is here.
MySQL database field collation inconsistency arises from an issue