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
[Compatibility]: JSON constructors drop MySQL binary type tags for binary, BLOB, and BIT values #28057
MatrixOne JSON constructors encode binary-like SQL values as bare Base64 strings. MySQL 8 encodes the same values as base64:type<field-type>:<payload>, preserving the original SQL type in the JSON value. The lost tag changes JSON text, equality, and values returned through JSON_EXTRACT/JSON_UNQUOTE.
Environment
Branch: main
Commit: 95d04586eb80864499d0fde27aeb912b463ae4cd
Deployment: local single-CN MatrixOne
Steps to reproduce
CREATETABLEt (
id INTPRIMARY KEY,
vb VARBINARY(8),
bl BLOB,
bits BIT(4)
);
INSERT INTO t VALUES (1, X'00FF41', X'00FF41', b'1010');
SELECT
JSON_UNQUOTE(JSON_EXTRACT(JSON_ARRAY(vb, bl, bits), '$[0]')),
JSON_UNQUOTE(JSON_EXTRACT(JSON_ARRAY(vb, bl, bits), '$[1]')),
JSON_UNQUOTE(JSON_EXTRACT(JSON_ARRAY(vb, bl, bits), '$[2]'))
FROM t;
The same difference occurs through JSON_OBJECT and JSON_SET.
Expected behavior
For MySQL compatibility, JSON constructors should preserve the binary source type in the JSON text using MySQL's base64:type<field-type>: representation.
Stability and controls
Reproducer: 3/3 on MatrixOne main for JSON_ARRAY and JSON_SET.
JSON_OBJECT reproduces the same values for VARBINARY, BLOB, and BIT.
MySQL 8 control consistently distinguishes field types 15, 252, and 16 for the identical input bytes.
Printable text inputs are handled as ordinary JSON strings; this difference is specific to binary-like SQL types.
Code analysis
pkg/sql/plan/function/func_builtin_json.go routes BINARY, VARBINARY, and BLOB through a single TpCodeOpaque representation before JSON creation. This discards the source type needed for MySQL-compatible output; BIT follows its own typed path but also emits bare Base64.
Regression coverage
After a fix, add deterministic coverage for BINARY/VARBINARY, BLOB, and BIT through JSON_OBJECT, JSON_ARRAY, and JSON_SET, including a non-UTF-8 payload.
本次范围:JSON 构造函数对 BINARY、VARBINARY、BLOB、BIT 的 MySQL binary type tag、prepared metadata/protocol 及 NULL/nonmatch/大数组行为;同时复验 binary MEMBER OF 的具体 subtype conversion。
Automation checkpoint: merged PR #28093 is being validated against current upstream/main 6d44c50. This issue remains open in phase/testing; no terminal tester PASS has been recorded in the current handoff. Please report complete version, environment, scoped scenario results, and terminal PASS/FAIL evidence before any closure decision.
Activity
fix(json): preserve MySQL binary subtype fidelity (#28092)
fix(json): unify constructor value conversion (#28093)
VioletQwQ-0 commentedon Sep 8, 2026
【QA 交接|PR #28093 已合并】
关联合并:PR #28093(merge commit 8836fb4);当前 main=1cfec4c80134adc5640a3bbf1aef7aaa87a45282。
本次范围:JSON 构造函数对 BINARY、VARBINARY、BLOB、BIT 的 MySQL binary type tag、prepared metadata/protocol 及 NULL/nonmatch/大数组行为;同时复验 binary MEMBER OF 的具体 subtype conversion。
合并后证据:PR required checks 无失败;本地 exact-main CGo 自测因缺少 cgo/libmo.dylib 阻塞,mo-tester 未安装,未宣称本地 PASS。
请在合并版本覆盖常量、预编译参数、重绑定、CAST/JSON 构造差异、单 CN 与多 CN、重启/读回。PASS 标准是 JSON 类型标签、字节值和 MySQL 8 一致;FAIL 时请保留 SQL、main SHA、重复轮次和实际/期望结果。
VioletQwQ-0 commentedon Sep 8, 2026
补充 pin:远端 main 已推进到 9f87b62。请以该当前 main 复验;此前列出的合并提交、测试范围和 PASS/FAIL 标准保持不变。该更新不代表 QA PASS。
VioletQwQ-0 commentedon Sep 8, 2026
再次补充 pin:远端 main 已推进到 9cedf6e。请以该当前 main 复验;此前列出的合并提交、测试范围和 PASS/FAIL 标准保持不变。该更新不代表 QA PASS。
VioletQwQ-0 commentedon Sep 8, 2026
Automation checkpoint: merged PR #28093 is being validated against current upstream/main 6d44c50. This issue remains open in phase/testing; no terminal tester PASS has been recorded in the current handoff. Please report complete version, environment, scoped scenario results, and terminal PASS/FAIL evidence before any closure decision.
Ariznawlll commentedon Sep 9, 2026
测试版本
maina9d3b8b857c44f1249e682c91d4d62a914eb7d20原问题验证
验证二进制值进入 JSON constructor 时保留二进制类型标记,而非被误当成普通字符串。
Happy Path 覆盖
Unhappy Path 覆盖
以三种不同物理二进制族交叉覆盖,确认修复不是只覆盖单一 binary 类型,且容器切换不改变 tag。
白盒验证
不适用:以 protocol 返回类型与 JSON 结果验证客户端可见类型契约。
回归测试
suites/14_issue_regression/t/issue_28056_28057_28058_28060_json_constructor_types.test。--record --repeat 3和非 record--repeat 3均通过;PR 共 21/21 用例、321/321 条语句成功。测试证据
三种二进制族及 object/array/set 均重复 3 次。
测试结论
测试通过。
fix(json): preserve MySQL binary subtype fidelity (matrixorigin#28092)
fix(json): unify constructor value conversion (matrixorigin#28093)
fix(json): preserve MySQL binary subtype fidelity (matrixorigin#28092)
fix(json): unify constructor value conversion (matrixorigin#28093)
fix(json): preserve MySQL binary subtype fidelity (matrixorigin#28092)
fix(json): unify constructor value conversion (matrixorigin#28093)