Repository navigation
Description
Proposed consolidated tracking scope: 声明的列与索引元数据无损呈现
These are independent reproductions grouped under one acceptance contract; a common immediate root cause is not assumed. Administrative consolidation does not claim that any defect is fixed. Original report bodies and discussions remain available at the links below.
Included reports
- #30935 — [Bug]: prefix-index length is missing from STATISTICS.SUB_PART and SHOW INDEX metadata
- #30937 — [Bug]: information_schema truncates valid generated-column expressions at 500 characters
Acceptance checklist
- Keep ENUM/SET character-length and numeric-classification cases, including multibyte labels.
- Report prefix lengths as numeric SUB_PART/Sub_part and preserve actual SQL NULL for non-prefix indexes.
- Return full generated expressions beyond 500 characters; compare with SHOW CREATE and evaluated values, independently of prefix-index and ENUM/SET paths.
Problem
information_schema.COLUMNS misclassifies supported ENUM and SET columns: both have CHARACTER_MAXIMUM_LENGTH and CHARACTER_OCTET_LENGTH as SQL NULL, while SET also has NUMERIC_PRECISION=20 and NUMERIC_SCALE=0. MySQL reports their maximum rendered label length as character metadata and leaves numeric metadata NULL. Schema introspection/migration tools can treat SET as numeric or omit length constraints.
Environment and reproduction
- MatrixOne official
maind4c37f4d8722dd91b80f5f5547940004bf1b293f, isolated locally built two-CN cluster, SQL ports 6431/6432. - MySQL 8.3.0 reference on a private Unix socket.
- Three independent fresh MO table definitions, read from both CNs; result 3/3. Temporary database/user/role cleaned by the runner.
CREATE TABLE t(
id INT PRIMARY KEY,
e ENUM('a','bb'),
s SET('a','bb')
);
SELECT column_name, data_type,
character_maximum_length, character_octet_length,
numeric_precision, numeric_scale
FROM information_schema.columns
WHERE table_schema=DATABASE() AND table_name='t'
ORDER BY ordinal_position;For e, MatrixOne returns NULL, NULL, NULL, NULL in the four metadata fields; for s, it returns NULL, NULL, 20, 0. On MySQL 8.3 with default utf8mb4, e is 2, 8, NULL, NULL and s is 4, 16, NULL, NULL. The id INT precision/scale control agrees (10,0). The same defect persists with ENUM('z','a')/SET('z','a') and UTF-8 labels ENUM('中','长长')/SET('中','长长'); MySQL respectively reports character lengths 1/3 and 2/4, whereas MO continues returning NULL and SET numeric precision 20.
Stored ENUM/SET values and SHOW CREATE TABLE labels were correct. Duplicate-primary-key insertion was rejected, leaving exactly one source row; both CN connections remained healthy. This is a catalog metadata defect, not proof that value storage is wrong.
White-box and duplicate check
pkg/util/sysview/predefined.go:570-590 builds the COLUMNS view using internal_char_length(mc.atttyp) and internal_numeric_precision(mc.atttyp) without using mc.attr_enum to derive the declared ENUM/SET label lengths. pkg/sql/plan/function/func_builtin.go:855-883 only returns character length for ordinary MySQL string type OIDs. This explains ENUM's missing length; SET's numeric precision appears to follow its internal numeric storage representation. This is a starting point for a fix, not a claimed fully traced patch.
Searched open and closed issues and mysql-compatibility-contract. Closed #25103 fixed missing general varchar/decimal metadata and ORM introspection but did not cover ENUM/SET lengths or SET's false numeric classification. #30931 tracks ENUM/SET boolean value semantics, a separate execution path.
Evidence: EnumSetMetadata.java, /private/tmp/mo-explore-run-20261023/prepared_123922 (three passing source/error/metadata checks), and direct MySQL 8.3 queries for all three label definitions.
Activity
gouhongshen commentedon Oct 27, 2026
PR #31489 is trying to fix this issue.
fix(sysview): publish declared COLUMNS metadata, numeric SUB_PART and…
fix(sysview): declare catalog metadata through the shutdown-only model
fix(sysview): publish declared-label COLUMNS metadata, prefix SUB_PAR…
fix(sysview): publish declared-label COLUMNS metadata, prefix SUB_PAR…
fix(sysview): publish declared COLUMNS metadata, numeric SUB_PART and…
fix(sysview): publish declared COLUMNS metadata, numeric SUB_PART and…
gouhongshen commentedon Oct 30, 2026
PR #31489 has merged and is awaiting manual validation. The issue remains open.
XuPeng-SH commentedon Oct 30, 2026
转 QA 验证:#31489 已合入 main,合并提交
8197e28bc67c504a689ce8f38e1de56b5aac4982。COLUMNS 使用声明 ENUM/SET 标签计算字符/字节长度并使数值元数据为 NULL,经已有升级路径发布;当前 issue 完整评论只有合入待人工验证,无未完成开发 follow-up。
本轮证据为 issue 全文/完整评论与合并源码、测试内容静态核对,未运行本地 MatrixOne 实例或回归;PR 作者自述的运行结果不算本轮独立测试。当前未找到适用于新修复的已验证反例或仍未完成的开发 follow-up,按转测口径交给 Ariznawlll;这不是验收通过。
请 QA 继续覆盖:已有/新建租户、升级失败重试、ENUM/SET 多字节/空标签/重排与整数对照;PR 披露的逗号标签旧编码限制仍保留,不把它或跨版本分布式验证声称已解决。
Ariznawlll commentedon Oct 31, 2026
结论
测试通过。合并 issue 所要求的 ENUM/SET 字符元数据、索引前缀长度及长生成表达式,在所测新建与已有租户场景中符合预期。
关键证据
main@fe3b5591edac949af74ced9e0f3d61433826c582;修复 fix(sysview): publish declared COLUMNS metadata, numeric SUB_PART and full generated expressions #31489 的合并提交8197e28bc67c504a689ce8f38e1de56b5aac4982在祖先链。源码内隔离 embedded 升级夹具以该 SHA 的干净受版本控制源码构建,额外添加仅用于本轮验证的测试文件。SUB_PART为 3;升级后新建租户同样通过。SHOW CREATE TABLE一致,长度超过 500,计算结果为 207;上述升级路径及新租户均检查。项目TestIssue30936定向测试在该源码上重复 3 次成功,覆盖空标签、标签重排、整数对照及多字节元数据。main@6e5f2ce0fa52b834e39fb4ada00984fa57c02c14双 CN 各运行 3/3。待解决点