Skip to content

MDEV-37262 XMLISVALID() schema validation function.#5177

Open
holyfoot wants to merge 1 commit into
mainfrom
bb-13.1-mdev-37262-hf
Open

MDEV-37262 XMLISVALID() schema validation function.#5177
holyfoot wants to merge 1 commit into
mainfrom
bb-13.1-mdev-37262-hf

Conversation

@holyfoot
Copy link
Copy Markdown
Contributor

@holyfoot holyfoot commented Jun 4, 2026

XMLVALID function added to the XMLTYPE plugin.

XMLVALID function added to the XMLTYPE plugin.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Alexey Botchkov seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the new native function XMLISVALID to the type_xmltype plugin, adding comprehensive XML schema validation tests and registering the function descriptor. However, two critical issues must be addressed: the newly referenced source file item_func_xml_isvalid.cc is missing from the pull request, which will cause immediate build failures, and the raw pointer member m_data in Item_func_xml_isvalid is left uninitialized, risking undefined behavior or segmentation faults.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


MYSQL_ADD_PLUGIN(type_xmltype
plugin.cc sql_type_xmltype.cc
plugin.cc sql_type_xmltype.cc item_func_xml_isvalid.cc
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The file item_func_xml_isvalid.cc has been added to the MYSQL_ADD_PLUGIN source list, but the file itself is missing from this pull request. This will cause the build to fail immediately. Please ensure that item_func_xml_isvalid.cc is committed and included in the pull request.

{
protected:
String m_tmp_schema, m_tmp_xml;
MY_XML_VALIDATION_DATA *m_data;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The member pointer m_data is not initialized in the constructors of Item_func_xml_isvalid. Since it is a raw pointer, it will contain garbage values upon object creation. If any method (such as val_bool(), cleanup(), or a destructor) checks if (m_data) before allocation or deallocation, it can lead to undefined behavior or segmentation faults. Please initialize m_data to nullptr using in-class member initialization.

Suggested change
MY_XML_VALIDATION_DATA *m_data;
MY_XML_VALIDATION_DATA *m_data= nullptr;

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants