Skip to content

feat(sql): support bounded XML functions - #29179

Merged
XuPeng-SH merged 6 commits into
mainfrom
codex/issue-28306-xml-functions
Sep 21, 2026
Merged

XuPeng-SH merged 6 commits into
mainfrom
codex/issue-28306-xml-functions

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #28306

What this PR does / why we need it:

Adds ExtractValue(xml, xpath) and UpdateXML(xml, xpath, replacement) with an explicitly documented bounded XPath subset. Supported paths include descendants, attributes, positional and literal predicates, unions, and count(). Unsupported features fail explicitly rather than silently returning an empty result.

Raw XML spans preserve entities, lexical prefixes, and unaffected replacement bytes. Malformed XML yields NULL with warning 1525; XPath validation precedes document/replacement NULL handling. Constant XPath expressions and prepared parameters are supported, with no cross-execution cache. Results have nullable LONGTEXT metadata so CTAS can safely retain values above VARCHAR capacity.

Untrusted inputs have byte, depth, node, AST, work and scratch limits. No external entity resolution, added dependencies, background workers, or persistent cache. IDs are append-only; all executing CNs must be upgraded before using the functions. This is not a complete XPath 1.0 implementation; see docs/design/mysql_xml_functions.md for accepted scope and limits.

Validation:

  • Oracle-backed XML/XPath, vector warning/mask/reuse/resource and planner tests.
  • Owning function and planner packages pass (19.120s / 18.977s).
  • Isolated public BVT: 47/47 checks, two normal comparisons (0.478s / 0.402s), with zero leftover databases and same-instance repeat.
  • Validated nullable LONGTEXT CTAS and 65,536-byte result, prepared reuse, warning/error precedence, malformed input and unsupported syntax.
  • GPT-6 medium design revision 2 approved; final review/evidence and incremental static checks recorded in the task handoff.

No CI result is claimed. Parent owns publication.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all changed hunks at exact head 2d98d0122118f936234ef07e09767fcaa48f65bc against 57c280ed48fdccec3c2eb25042820deaf1eca3c1.

P1 remains: docs/design/mysql_xml_functions.md:3 lacks explicit authorized-maintainer acceptance of the exact design artifact. The document still says revision 2, but its current blob is 5f2dde64da0a75e52adbfd08a7a7d5cdbf6081e2, replacing bb99f4dce1ede4c5ed12630ca29e7a3acf84e8ba. Acceptance must include the descendant-text/count and QName amendments. AI/parent claims, the empty earlier APPROVE and ordinary implementation reviews do not satisfy this gate.

The four prior code findings are fixed: child-literal text-record comparison, attribute self context under //, descendant text() evaluation and malformed QName rejection. No additional concrete implementation blocker was found.

Exact-head CI is green. The proxy/compose XML BVT passed 52/52; the earlier pessimistic 47/47 result is not current-head evidence. Coverage percentage was not a gate.

Internal recommendation: BLOCKED pending exact-design acceptance. COMMENT only because this PR is self-authored.

@XuPeng-SH
XuPeng-SH merged commit df41cc2 into main Sep 21, 2026
27 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/issue-28306-xml-functions branch September 21, 2026 06:05

This branch was previously deployed

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

Labels

kind/bug Something isn't working kind/documentation Improvements or additions to documentation kind/feature size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compatibility]: MySQL ExtractValue and UpdateXML functions are unavailable

4 participants