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

EXISTS subquery with correlation in ON expression crashes

    XMLWordPrintable

Details

    Description

      This is a followup to MDEV-25380.

      sql/item_subselect.cc has this comment in Item_subselect::walk():

            /* TODO: why does this walk WHERE/HAVING but not ON expressions of outer joins? */
      

      This is a testcase for it:

      create table ten(a int primary key);
      insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
      create table one_k(a int primary key);
      insert into one_k select a.a + b.a* 10 + c.a * 100 from ten a, ten b, ten c;
      create table t1 (a int, b int);
      insert into t1 select a,a from ten;
      create table t2 (a int, b int);
      insert into t2 select a,a from one_k;
      create table t3 as select * from t2;
      explain
      select *  from t1  
      where 
      exists (select t2.a from t2 left join t3 on (t3.b=t1.b) where t2.a=t1.a);
      

      Crashes with:

      mariadbd: /home/psergey/dev-git2/10.5-cp2/sql/sql_select.cc:8820: bool greedy_search(JOIN*, table_map, uint, uint, uint): Assertion `join->best_read < double(1.79769313486231570814527423731704357e+308L)' failed.
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.