Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Other Environment Information
- MatrixOne was built from the commit above and started locally with etc/launch/launch.toml.
- MySQL comparison version: 8.0.45.
- Every expression was repeated three times with the same result.Actual Behavior
MatrixOne does not implement MySQL's ExtractValue() and UpdateXML()
functions. Every valid call is rejected during function resolution:
not supported: function or operator 'extractvalue'
not supported: function or operator 'updatexml'
This includes simple node extraction, multiple matching nodes, attributes,
XPath count(), missing nodes, replacement of one matching node, empty or
malformed XML, and NULL propagation.
Expected Behavior
MatrixOne should support the MySQL 8.0 XML function behavior. MySQL 8.0.45
returns the following representative values:
ExtractValue('<a><b>1</b></a>','/a/b') 1
ExtractValue('<a><b>1</b><b>2</b></a>','/a/b') 1 2
ExtractValue('<a id="7"/>','/a/@id') 7
ExtractValue('<a><b/><b/></a>','count(/a/b)') 2
UpdateXML('<a><b>1</b></a>','/a/b','<c>2</c>') <a><c>2</c></a>
Missing XPath matches leave UpdateXML unchanged, and more than one match
also leaves it unchanged. NULL input produces NULL. Malformed XML produces
NULL with a warning in MySQL.
Steps to Reproduce
SELECT ExtractValue('<a><b>1</b></a>','/a/b');
SELECT ExtractValue('<a><b>1</b><b>2</b></a>','/a/b');
SELECT ExtractValue('<a id="7"><b>x</b></a>','/a/@id');
SELECT ExtractValue('<a><b/><b/></a>','count(/a/b)');
SELECT ExtractValue('<a><b>1</b></a>','/a/c');
SELECT ExtractValue('','/a');
SELECT ExtractValue('<a>','/a');
SELECT ExtractValue(NULL,'/a');
SELECT ExtractValue('<a/>',NULL);
SELECT UpdateXML('<a><b>1</b></a>','/a/b','<c>2</c>');
SELECT UpdateXML('<a><b>1</b><b>2</b></a>','/a/b','<c>3</c>');
SELECT UpdateXML('<a><b>1</b></a>','/a/c','<c>2</c>');
SELECT UpdateXML(NULL,'/a','<x/>');Additional information
MySQL requires the XPath expression to be constant. A table-column XPath was
also checked and MySQL itself rejects it with Only constant XPATH queries are supported; that behavior is not included as a MatrixOne gap.
No ExtractValue or UpdateXML function ID/overload is registered under
pkg/sql/plan/function in the current MatrixOne source tree.
Activity
feat(sql): support bounded XML functions (#29179)
Ariznawlll commentedon Sep 22, 2026
测试版本
main3727c5c5436ca136d7b0312f75bc223a11692a85原问题验证
MySQL 兼容函数
ExtractValue和UpdateXML在当前版本均可调用并返回正确结果。Happy Path 覆盖
ExtractValue覆盖文本与属性提取;UpdateXML覆盖匹配节点更新并检查完整 XML 结果。Unhappy Path 覆盖
覆盖无匹配路径、非法 XML 和 NULL 输入;非法 XML 返回 warning 1525,未触发 panic。
白盒验证
同时覆盖常量求值与 PREPARE/EXECUTE 参数复用路径,重复执行的类型和结果稳定。
回归测试
新增
suites/14_issue_regression/t/issue_28306_xml_functions.test,已提交至 motr#199。测试证据
定向用例连续执行 3 轮;本次新增 7 个 case 共执行 21 次,结果为
21/21通过。14_issue_regression整套执行时该用例也通过。MOTR 当前未为该分支上报远端 checks。测试结论
测试通过。