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

Server crash when using a NAME_CONST() with a CURSOR

    XMLWordPrintable

    Details

      Description

      This script makes the server crash in a debug build:

      SET sql_mode=STRICT_ALL_TABLES;
      CREATE OR REPLACE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (10);
      DELIMITER $$
      BEGIN NOT ATOMIC
        DECLARE a INT;
        DECLARE c CURSOR FOR SELECT NAME_CONST('x','y') FROM t1;
        OPEN c;
        FETCH c INTO a;
        CLOSE c;
      END;
      $$
      DELIMITER ;
      

      If I change sql_mode to empty, it works fine:

      SET sql_mode='';
      CREATE OR REPLACE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (10);
      DELIMITER $$
      BEGIN NOT ATOMIC
        DECLARE a INT;
        DECLARE c CURSOR FOR SELECT NAME_CONST('x','y') FROM t1;
        OPEN c;
        FETCH c INTO a;
        CLOSE c;
      END;
      $$
      DELIMITER ;
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: