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

Crash in Item_field::used_tables() called by Item::derived_field_transformer_for_having

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (a INT, b INT, c INT);
      CREATE TABLE t2 (d INT, e INT, f INT);
       
      INSERT INTO t1 VALUES (1,1,66), (1,1,38), (3,3,66);
      INSERT INTO t2 VALUES (1,1,66), (1,12,32), (3,3,66);
      

      The query that fails uses equalities. One of these equalities should be pushed into the WHERE clause and the two others into the HAVING clause.

      SELECT * 
      FROM t2,
      (
        SELECT a, b, max(c) AS max_c
        FROM t1
        GROUP BY a 
        HAVING max_c > 37
      ) AS v1
      WHERE (v1.a=1) AND (v1.b=v1.a) AND 
                   (v1.a=t2.e) AND (v1.max_c=66); 
      

      Attachments

        Activity

          People

            shagalla Galina Shalygina
            shagalla Galina Shalygina
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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