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

Loss of column aliases by using view and group

    Details

      Description

      hello,

      upgrade from 10.2 to 10.3 due to a crash in some of my stored procedures.

      Since the upgrade from 10.2 to 10.3, the column name is output incorrectly if the column is formed in the view using a function and is used WHERE- and GROUP BY-statements in the query.

      I tested it on a Server with 10.2: in all cases the output is "bar" as column-name
      on 10.3 the output is "foo" in the last case

      CREATE TABLE t1 (id int, foo int);
      CREATE VIEW v1 AS  SELECT id, IFNULL(foo,'') AS foo FROM t1;
       
      INSERT INTO t1 (id, foo) VALUES (1,1),(2,2);
       
      SELECT v.id, v.foo AS bar  FROM v1 v
        WHERE id = 2;
      //normal output as "bar"
      -- id , bar
      -- 2  , 2
       
      SELECT v.id, v.foo AS bar  FROM v1 v
        GROUP BY v.id;
      //normal output as "bar"
      -- id , bar
      -- 1  , 1
      -- 2  , 2
       
      SELECT v.id, v.foo AS bar  FROM v1 v
        WHERE id = 2
        GROUP BY v.id;
      //unexpected output as "foo"!! only in 10.3
      -- id , foo
      -- 2  , 2
       
      //Cleanup
      Drop View v1;
      Drop table t1;
      

        Attachments

          Activity

            People

            • Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              FriedemannS Friedemann Schmidt
            • Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: