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

Lost name of a explicitly named CTE column used in a view created via prepared statement

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2
    • Fix Version/s: 10.2.14
    • Component/s: Optimizer
    • Labels:
      None

      Description

      The following demonstrates the problem:

      MariaDB [test]> create view v1 as
          -> with cte(a) as (select 1 from dual) select * from cte;
      Query OK, 0 rows affected (0.01 sec)
       
      MariaDB [test]> select * from v1;
      +---+
      | a |
      +---+
      | 1 |
      +---+
      1 row in set (0.01 sec)
       
      MariaDB [test]> set @view_def = "
          "> create view v2 as with cte(a) as (select 1 from dual) select * from cte
          "> ";
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> PREPARE stmt FROM @view_def;
      Query OK, 0 rows affected (0.00 sec)
      Statement prepared
       
      MariaDB [test]> EXECUTE stmt;
      ERROR 1054 (42S22): Unknown column 'cte.a' in 'field list'
      

      Note that the definitions of v1 and v2 are identical.

        Attachments

          Activity

            People

            Assignee:
            shagalla Galina Shalygina (Inactive)
            Reporter:
            igor Igor Babaev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration