Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10142 PL/SQL parser
  3. MDEV-12209

sql_mode=ORACLE: Syntax error in a OPEN cursor with parameters makes the server crash

    Details

    • Sprint:
      10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

      Description

      The below script makes the server crash. Notice a syntax error in OPEN(a+,b);.

      SET sql_mode=oracle;
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT, b VARCHAR(10));
      INSERT INTO t1 VALUES (1,'A');
      DROP PROCEDURE IF EXISTS p1;
      CREATE TABLE t1 (a INT, b VARCHAR(10));
      DELIMITER $$
      CREATE PROCEDURE p1(a INT,b VARCHAR)
      AS
        CURSOR c (p_a INT, p_b VARCHAR) IS SELECT * FROM t1 WHERE a=p_a;
      BEGIN
        OPEN c(a+, b);
        LOOP
          FETCH c INTO a, b;
          EXIT WHEN c%NOTFOUND;
          SELECT a, b;
        END LOOP;
        CLOSE c;
      END;
      $$
      DELIMITER ;
      CALL p1(1,'a');
      DROP TABLE t1;
      

        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: