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]: VARCHAR ALTER on a self-referencing FK table resolves table ID 0 (v4.2.5) #29910
I searched exact error strings, failing syntax and affected native applications; no matching issue was identified. Related reports are distinguished below.
Application compatibility replay on official v4.2.5
Branch Name
Official stable release v4.2.5; current main has not been retested for this report.
Linux x86_64 standalone official binary, 4 CPUs, ~16 GiB container memory limit. SELECT VERSION() = 8.0.30-MatrixOne-v4.2.5. PyMySQL 1.2.3 client. Only fresh owned test schemas were used for SQL probes; the native Airflow diagnostic is a read-only SELECT against the retained test fixture.
Actual Behavior
Native application impact: 普通 VARCHAR 长度修改报 20101 can not find table by id 0;小表两行复现,DROP 自引用 FK 后仍失败。
ERROR 20101: internal error: can not find table by id 0: accountId: 0
Expected Behavior
Allow a VARCHAR length change on a self-referencing FK table. Preserve both existing rows and actual foreign-key enforcement; do not resolve the self-reference sentinel as a physical table ID.
Steps to Reproduce
Use a dedicated fresh test schema (create one without DROP DATABASE), then run:
This is release v4.2.5 evidence, not a claim that the same failure remains on current main.
Observation family MO-OBS-030. App-side workarounds do not constitute an engine fix.
All disclosed values are owned synthetic fixtures; no passwords, tokens, application cookies or raw private logs are attached.
Related #26838 concerns TRUNCATE of a self-FK table. This new report uses MODIFY COLUMN VARCHAR with two existing rows. Earlier separate probes also reproduced the ALTER failure after DROP FOREIGN KEY; both original rows and a re-added FK were retained.
Built and actually ran upstream main 02a2823c2007d5e4fb4ada148e93743df337551a, with git_version() = 02a2823, Go 1.27.1, Linux amd64, the official make build CPU entrypoint, gcc/g++, and separate fresh main cluster storage. Binary SHA-256: ce8b149f0da8c8a06ec8786c4d311795e6893420bd15be29d6e6b9cab44bb2f5. SQL checks ran 2026-10-12 06:04 UTC; upstream main was re-read before execution and still resolved to this SHA.
Comparison: official v4.2.5 / 1a44f3db3056e32975fde86ca0ab69a094996a3f (git_version() = 1a44f3d). Both sides used fresh owned schemas and identical regression fixture hashes. This checks the disclosed reproducer; complete native application workflows have not been rerun on main. No issue is being closed automatically.
SQL-SELF-FK-ALTER: stable known_failure → main candidate_fixed
The reproducer completed and its result/constraint assertions passed on this main snapshot; the stable failure no longer reproduces for this fixture.
Fixture SHA-256: 1b6ca1ef6334a235e93db4ad8a05ed2fef7a75e159d9fafc0b38a49bc9d7df84. A fresh SELECT 1 after the trigger succeeded: True.
按 issue 的两行自引用 FK 表复现:(1,NULL,'parent')、(2,1,'child'),执行 ALTER TABLE self_probe MODIFY COLUMN URL VARCHAR(125)。三轮独立建库均成功,原两行保留;没有出现旧版的 can not find table by id 0。每轮结束均删除本轮测试库。
Activity
dengn commentedon Oct 12, 2026
Runtime recheck on current main
Built and actually ran upstream main
02a2823c2007d5e4fb4ada148e93743df337551a, withgit_version()=02a2823, Go 1.27.1, Linux amd64, the officialmake buildCPU entrypoint, gcc/g++, and separate fresh main cluster storage. Binary SHA-256:ce8b149f0da8c8a06ec8786c4d311795e6893420bd15be29d6e6b9cab44bb2f5. SQL checks ran 2026-10-12 06:04 UTC; upstream main was re-read before execution and still resolved to this SHA.Comparison: official v4.2.5 /
1a44f3db3056e32975fde86ca0ab69a094996a3f(git_version()=1a44f3d). Both sides used fresh owned schemas and identical regression fixture hashes. This checks the disclosed reproducer; complete native application workflows have not been rerun on main. No issue is being closed automatically.SQL-SELF-FK-ALTER: stable
known_failure→ maincandidate_fixedThe reproducer completed and its result/constraint assertions passed on this main snapshot; the stable failure no longer reproduces for this fixture.
Fixture SHA-256:
1b6ca1ef6334a235e93db4ad8a05ed2fef7a75e159d9fafc0b38a49bc9d7df84. A freshSELECT 1after the trigger succeeded:True.Returned rows:
[].Independent postchecks:
[{"sql": "SELECT id,parent_id,URL FROM self_probe ORDER BY id", "passed": true, "rows": [[1, null, "parent"], [2, 1, "child"]]}, {"sql": "INSERT INTO self_probe VALUES(3,999,'must reject')", "passed": true, "error_code": 1452}].Detailed SQL, assertions, source/build identity and JSON evidence (organization regression repository): https://github.com/matrixorigin/matrixone-app-regression/tree/01517d2f73abb5021ca545193c2af38ef653f278/evidence/main-02a2823
fix(plan): handle empty indexed FK cascades and cover self-FK ALTER (#…
Ariznawlll commentedon Oct 15, 2026
测试版本
mainbb2b725d0af4601d02ebf9cc68b1816a2b300022(源码构建的本地测试实例;SELECT git_version()在 embedded 测试实例返回unknown,版本以隔离 worktree 的 Git SHA 和构建源码为准)5d971d07a7c5a52a71f2c10390b109cebf5c0825,已核对为上述官方 main 的祖先原问题验证
按 issue 的两行自引用 FK 表复现:
(1,NULL,'parent')、(2,1,'child'),执行ALTER TABLE self_probe MODIFY COLUMN URL VARCHAR(125)。三轮独立建库均成功,原两行保留;没有出现旧版的can not find table by id 0。每轮结束均删除本轮测试库。Happy Path 覆盖
VARCHAR(100) -> VARCHAR(125)DDL 成功 3/3;原两行及父子关系不变,information_schema.columns.character_maximum_length=125。(3,2,REPEAT('x',125))成功 3/3,读回parent_id=2、LENGTH(URL)=125;验证新长度边界和自引用约束仍可用。SELECT 1正常并清理专属 schema。Unhappy Path 覆盖
(4,999,'orphan'),3/3 返回 1452;随后读取原三行,未出现孤儿行,验证拒绝操作的原子性和 FK 未被 ALTER 破坏。白盒验证
本次为公开 SQL 黑盒验收,未新增或运行 Go UT /
-race;该路径不依赖内部故障注入。关联修复 PR 的白盒检查不计作本次独立测试。回归测试
suites/14_issue_regression/t/issue_29910_self_fk_alter.test与对应r/issue_29910_self_fk_alter.result,精确断言行、长度、NULL、1452 和失败后的状态。14_issue_regressionsuite 和集成 CI 尚未执行,后续继续跟踪,不将其写成已通过。测试证据
total=3 success=3 failed=0 skipped=0 | stmts=42 ok=42 fail=0;独立 Go SQL 探针三轮均为alter=ok rows=2 invalid_fk=1452 atomic=ok valid_fk=ok cleanup=ok。测试结论
测试通过。