Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-42422

XMLTYPE getRootElement()/getNamespace() value lost when it is the first argument of CONCAT

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • N/A
    • 13.3
    • None
    • None

    Description

      Item_func_xml_method_getRootElement::val_str() and Item_func_xml_method_getNamespace::val_str() return the caller's str after str->set() points it into the variable's value, so str does not own its buffer (alloced_length()==0). Item_func_concat::realloc_result() then calls str->alloc(), which empties the string before appending the next argument.

      --delimiter $$
      CREATE PROCEDURE p1()
      BEGIN
        DECLARE x XMLTYPE DEFAULT '<pk xmlns="pns"/>';
        SELECT CONCAT(x.getRootElement(), ',z') c1,
               CONCAT(x.getNamespace(), ',z') c2,
               CONCAT(x.getRootElement(), x.getRootElement()) c3;
      END$$
      --delimiter ;
      --echo # BUG if not pk,z  pns,z  pkpk
      CALL p1();
      DROP PROCEDURE p1;

      Actual:

      c1	c2	c3
      ,z	,z	pk

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.