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

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

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.22, 10.1.9, 10.0, 10.1
    • Fix Version/s: 5.5.48, 10.0.24, 10.1.13
    • Component/s: XML Functions
    • Labels:
      None
    • Environment:
      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
    • Sprint:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: