MDEV-37262 XMLISVALID() schema validation function.#5177
Conversation
XMLVALID function added to the XMLTYPE plugin.
|
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
| { | ||
| protected: | ||
| String m_tmp_schema, m_tmp_xml; | ||
| MY_XML_VALIDATION_DATA *m_data; |
There was a problem hiding this comment.
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.
| MY_XML_VALIDATION_DATA *m_data; | |
| MY_XML_VALIDATION_DATA *m_data= nullptr; |
XMLVALID function added to the XMLTYPE plugin.