You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: JSON_UNQUOTE rejects ordinary unquoted text #28042
JSON_UNQUOTE() rejects ordinary text that is not JSON. MySQL returns non-double-quoted input unchanged; only an input that both starts and ends with a double quote and is not a valid JSON string literal should raise an error.
Environment
Branch: main
Commit: 17c161a31b47a22e71ca222839143f66717ac365
Deployment: local single-CN test service
Test date: 2026-09-03
Steps to reproduce
SELECT JSON_UNQUOTE('plain text');
Actual behavior
MatrixOne returns:
ERROR 20301 (HY000): invalid input: json text plain text
Expected behavior
MySQL returns plain text unchanged. Its documented error boundary is narrower: an error occurs only when the argument starts and ends with double quotes but is not a valid JSON string literal.
Controls: JSON_UNQUOTE('"abc"') returns abc; JSON_UNQUOTE('[1,2]') returns [1, 2]; JSON_UNQUOTE(NULL) returns SQL NULL in each run.
No DDL or DML is involved.
Code analysis
For SQL string inputs, pkg/sql/plan/function/func_unary.go:JsonUnquote calls types.ParseSliceToByteJson(v) unconditionally before ByteJson.Unquote(). That forces ordinary text through JSON-document parsing. The required behavior is to bypass parsing and return the original input when it is not framed by double quotes; retain parse/error handling for a quote-framed candidate JSON string literal.
Regression coverage
After the fix, add deterministic cases for a valid JSON string literal, an array/object text value, SQL NULL, unquoted ordinary text, and malformed quote-framed text.
PR exact head: 64e3dbd; merge commit: 3d2e5c3. Exact-head TKE checkin run 34115028473 passed. The exact-head ALL CI UT run 34114766587 was terminated during resource-heavy tests after the runner received SIGTERM without terminal Go test events; it is not treated as a product semantic PASS or FAIL.
Activity
[-][Compatibility]: JSON_UNQUOTE rejects ordinary unquoted text[/-][+][Bug]: JSON_UNQUOTE rejects ordinary unquoted text[/+]Ariznawlll commentedon Sep 3, 2026
补充 MySQL 8.0.45 实测:
同一语句在 MatrixOne 当前 main 连续 3 次均返回
ERROR 20301 ... invalid input: json text plain text。fix(json): preserve plain text in JSON_UNQUOTE (#28090)
VioletQwQ-0 commentedon Sep 11, 2026
QA handoff for merged PR #28090: #28090
PR exact head: 64e3dbd; merge commit: 3d2e5c3. Exact-head TKE checkin run 34115028473 passed. The exact-head ALL CI UT run 34114766587 was terminated during resource-heavy tests after the runner received SIGTERM without terminal Go test events; it is not treated as a product semantic PASS or FAIL.
请重点复测普通未加引号文本、JSON-looking 文本、外层空白/单侧引号、畸形引号、无效 UTF-8、CHAR/VARCHAR/TEXT/MEDIUMTEXT/LONGTEXT 容量与 utf8mb4_bin 元数据、CTAS,以及 DATE/TIME/numeric 和 binary 域行为。Issue 保持 OPEN,当前仅转 QA,未声明关闭。
Ariznawlll commentedon Sep 11, 2026
测试版本
4a7bfac4f91fe3e4519e25ed82654556e38d670a。7013fbbd6e152ba31da2d3dbba7012ac7f8b8462,本地 2 CN、1 TN、1 Log 拓扑;修复提交3d2e5c336ed6b6d034908cd4d2012bc9737fe958已包含,且为上述官方 main 基线祖先。原问题验证
围绕
JSON_UNQUOTE对普通未加引号文本的兼容行为复测,确认普通文本不会被误判为 JSON 并拒绝,同时保留已定义的类型和格式错误路径。Happy Path 覆盖
plain text原样返回;合法 JSON 字符串返回abc。[1,2]、{"a":1}与 NULL 语义。varchar/utf8mb4/utf8mb4_bin,确保输出类型可继续使用。Unhappy Path 覆盖
JSON_UNQUOTE(123)稳定返回 20203。白盒验证
本 issue 的验收重点为 SQL 结果、错误码与 CTAS 元数据;无额外内部状态断言。
回归测试
14_issue_regression.issue_28042_json_unquote_text。./motr --repeat 3 --do-test '14_issue_regression\.issue_(28254|28233|28042)_.*' -v。测试证据
14_issue_regression运行中,本用例通过;其余 6 个既有用例的预期差异与本改动无关,未修改其基线。测试结论
测试通过。
fix(json): preserve plain text in JSON_UNQUOTE (matrixorigin#28090)
fix(json): preserve plain text in JSON_UNQUOTE (matrixorigin#28090)
fix(json): preserve plain text in JSON_UNQUOTE (matrixorigin#28090)