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

Variables declared after cursors with parameters lose value

    XMLWordPrintable

Details

    Description

      This problem is repeatable in bb-10.2-compatibility:

      This script:

      SET sql_mode=ORACLE;
      DROP PROCEDURE IF EXISTS p1;
      DELIMITER $$
      CREATE PROCEDURE p1() AS
        x0 INT:=100;
        CURSOR cur(cp1 INT, cp2 INT) IS SELECT cp1+cp2;
        x1 INT:=101;
      BEGIN
        OPEN cur(10,11);
        CLOSE cur;
        SELECT x0, x1;
      END;
      $$
      DELIMITER ;
      CALL p1();
      

      returns:

      +------+------+
      | x0   | x1   |
      +------+------+
      |  100 |   10 |
      +------+------+
      

      This is wrong. x1 should stay eqial to 101.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.