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

Variables declared after cursors with parameters lose value

    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

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

                Dates

                • Created:
                  Updated:
                  Resolved: