Bug in Combining 【CASE WHEN】 and 【JSON_EXTRACT】

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 【CASE WHEN】与【JSON_EXTRACT】结合使用的bug

| username: Peng

Bug Report

Clearly and accurately describe the issue you have found. Providing any steps to reproduce the issue can help the development team address it promptly.
[TiDB Version] v6.5

[Impact of the Bug] The SQL return value type is abnormal, causing Java to be unable to process the database return results correctly.

[Possible Steps to Reproduce the Issue] Directly execute the attached SQL.

[Observed Unexpected Behavior] You need to use a visual client tool to check the return value type. The types of returned ‘a’ and ‘e’ are problematic. This causes Java to encounter an exception when it receives the return result as a byte array (with square brackets [48]).

[Expected Behavior] The return value type viewed by the client tool should be longtext, text, or int, etc. Java should receive the return result as 0.

[Related Components and Specific Versions] Visual client tool: MySQL plugin for IDEA

[Other Background Information or Screenshots]
TiDBBugSql.sql (1.4 KB)

| username: Billmay表妹 | Original post link

Relevant discussions can be seen!

| username: aytrack | Original post link

Opened an issue: case when with json_extract not compatible with mysql-connector-java driver 5.1 · Issue #48004 · pingcap/tidb · GitHub. Follow up here.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.