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

Unexpected syntax error instead of "Unknown system variable" inside an SP

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.2, 10.3
    • Fix Version/s: 10.3.6
    • Component/s: Stored routines
    • Labels:
      None
    • Sprint:
      10.3.6-1

      Description

      I run this script, it correctly returns an "Unknown system variable" error:

      DELIMITER $$
      BEGIN NOT ATOMIC
        SET GLOBAL a=10;
      END;
      $$
      DELIMITER ;
      

      ERROR 1193 (HY000): Unknown system variable 'a'
      

      Now I modify the script slightly: additionally declare a local variable with name a:

      DELIMITER $$
      BEGIN NOT ATOMIC
        DECLARE a INT;
        SET GLOBAL a=10;
      END;
      $$
      DELIMITER ;
      

      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ';
      

      The error message looks confusing. The expected error message would be to return "Unknown system variable".

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration