Skip to content

[Compatibility]: MySQL ExtractValue and UpdateXML functions are unavailable #28306

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

74668fc

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

  1. added this to the MO-202609 milestone on Sep 7, 2026
  2. added
    kind/bug
    on Sep 7, 2026
  3. added theissue type on Sep 7, 2026
  4. self-assigned this
    on Sep 7, 2026
  5. added a commit that references this issue on Sep 21, 2026
    df41cc2
  6. Ariznawlll commented on Sep 22, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 日期:2026-09-22
    • 分支:main
    • MatrixOne commit:3727c5c5436ca136d7b0312f75bc223a11692a85
    • 部署:本地单机,1 Log / 1 TN / 1 CN

    原问题验证

    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。

    测试结论

    测试通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions