matrixorigin / matrixorigin/matrixone
[Compatibility]: MySQL ExtractValue and UpdateXML functions are unavailable
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
### Is there an existing issue for the same bug?
- [x] I have checked the existing issues.
### Branch Name
main
### Commit ID
74668fc075c965c462b30f10ae24a1c19c289cfd
### Other Environment Information
```Markdown
- 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:
```text
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:
```text
ExtractValue('1','/a/b') 1
ExtractValue('12','/a/b') 1 2
ExtractValue('','/a/@id') 7
ExtractValue('','count(/a/b)') 2
UpdateXML('1','/a/b','2') 2
```
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
```sql
SELECT ExtractValue('1','/a/b');
SELECT ExtractValue('12','/a/b');
SELECT ExtractValue('x','/a/@id');
SELECT ExtractValue('','count(/a/b)');
SELECT ExtractValue('1','/a/c');
SELECT ExtractValue('','/a');
SELECT ExtractValue('','/a');
SELECT ExtractValue(NULL,'/a');
SELECT ExtractValue('',NULL);
SELECT UpdateXML('1','/a/b','2');
SELECT UpdateXML('12','/a/b','3');
SELECT UpdateXML('1','/a/c','2');
SELECT UpdateXML(NULL,'/a','');
```
### 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.
Contributor guide
Assessment
This issue has not been assessed yet.