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

Confusion between table alias and ROW type variable

    Details

      Description

      This script:

      SET sql_mode=DEFAULT;
      CREATE OR REPLACE TABLE t1 (c1 INT, c2 INT);
      INSERT INTO t1 VALUES (0,0);
      DELIMITER $$
      DROP PROCEDURE IF EXISTS p1;
      CREATE PROCEDURE p1()
      BEGIN
        DECLARE a INT;
        DECLARE b INT;
        SELECT a.c1 INTO b
          FROM t1 a
         WHERE a.c2 = 0;
      END;
      $$
      DELIMITER ;
      CALL p1;
      

      works fine in 10.2. It treats a.c2 as a reference to the column a.c2, which is in fact t1.c2.

      Starting from bb-10.2-ext and 10.3, the same script fails to create the procedure with this error:

      ERROR 1105 (HY000): 'a' is not a row variable
      

        Attachments

          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: