Skip to content

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

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

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

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't workingneeds-triageNeeds evaluation before prioritization. Not yet decided whether to proceed

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions