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

GROUP BY mixing an aggregate with the grouping column over a mergeable view returns zero rows

    XMLWordPrintable

Details

    • Unexpected results

    Description

      CREATE TABLE b (id BIGINT);
      INSERT INTO b VALUES (1), (2);
      CREATE VIEW t AS SELECT * FROM b;
       
      SELECT MIN(id) + id
      FROM t t1
      WHERE t1.id >= ANY (SELECT t2.id FROM t t2)
      GROUP BY t1.id;
      -- Expected 2 rows (2), (4). Actual 0 rows.
      

      However, when selecting from the base table, the result is correct

      SELECT MIN(id) + id
      FROM b t1
      WHERE t1.id >= ANY (SELECT t2.id FROM t t2)
      GROUP BY t1.id;
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              junwenan Junwen An
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.