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

ExtractValue function doesn't work in stored procedure first few times

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.22, 10.1.9, 10.0, 10.1
    • 5.5.48, 10.0.24, 10.1.13
    • XML Functions
    • None
    • I have reproduced the bug with 10.0.22 from official repository on debian Jessie ( 10.0.22-0+deb8u1) and 10.1.9 on Windows
    • 10.2.0-9

    Description

      I have a stored procedure wich process an XML field to get some data. The first few times the procedure is executed it returns NULL or empty string, then it works fine. From HeidiSql, for example, it usually fails two times and then works right, and from ToadSql it fails about four times and then works everytime (the number of failures seems consistent, but could be luck).

      The line that seems to be failing is a call to ExtractValue (here with some context):

      DECLARE counter INT UNSIGNED DEFAULT 1;
      WHILE (counter <= total_count) DO
      SELECT ExtractValue(xml, '//service[$counter]/name') INTO service_name;
      SET services = CONCAT(services, ',', service_name);
      SET counter = counter + 1;
      END WHILE;

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              Soporte Estructure
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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