Incorrect string value: '\\xD0\\xA2\\xD0\\x9E\\xD0\\x9E…' for column Username in MySQL DataGrip specific

dba.stackexchange https://dba.stackexchange.com/questions/278115

  •  09-03-2021
  •  | 
  •  

Question

I know that such error can be caused by incorrect character set applied to some table, but in my case it's a bit different:
I have some procedure with select, create temporary table and cursor...
The actual problem is that if I do DROP/CREATE procedure from JetBrain's DataGrip and CALL it - error appears. But in case I do DROP/CREATE of SAME procedure without any modification from other software, for example I've used DBForge - CALL works just as expected! What can cause such behavior? I've used DataGrip for years now and this is the first time after which I start to worry about recreating procedures on production database.
Additional information: the error is caused by FETCH of Username column in cursor loop body. In case of commenting that part - everything works. So there is a problem FETCHING Username to my local variable DECLARE Username VARCHAR(300);. Sizes of variables are same.

Was it helpful?

Solution

A bit strange case, but I'll leave the answer we've came up to ourselves:

Fixed after I've used NVARCHAR (or VARCHAR CHARACTER SET UTF8;), not VARCHAR for variable declaration and for temporary table's creation scheme. The problem appeared ONLY when we used temp table in the script. For regular tables our VARCHAR with default DB collation/charset worked OK. I still don't know why DBForge ignored it and calling procedure created in it caused no problems (but there really were problems: "?" instead of UTF8 characters).

UPDATE: added issue on DataGrips tracker, because I think that failing to execute the procedure is not the correct behavior in such case: https://youtrack.jetbrains.com/issue/DBE-11789

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top