When using MyBatis to delete a partition from a table, a java.sql.SQLException: json: cannot unmarshal string into Go value of type []string exception occurs. How should the SQL be modified in this situation?
This doesn’t quite meet expectations. However, since the old version 4.0.x is basically no longer updated, if conditions permit, please upgrade to 6.5.0 to see if the issue still exists!
If there is a bug, it is most likely a JDBC compatibility issue. This is a fundamental feature, and we will fix it.
By comparing the packet capture situations of different versions of TiDB, it was found that the operation is normal under 4.0.8, while such a problem occurs in 4.0.2. By checking the release history, there are changes in the code related to partition. If TiDB before 4.0.5 is used with TiKV after 4.0.5, it will lead to unmarshal issues. Therefore, keeping both versions consistent generally avoids problems.
Sorry, I made a mistake earlier and wrote down the version of Spring. 5.2.8 is the version of Spring, and the version of mysql-connector-java is 8.0.21.
MyBatis is 3.5.10, it shouldn’t be an issue with other parameters. I tried again, and version 4.0.2 throws the following exception:
java.sql.SQLException: json: cannot unmarshal string into Go value of type string
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:370)