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

LP:813489 - Wrong result with outer join + nested subquery with ALL

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Resolution: Not a Bug
    • None
    • None
    • None

    Description

      The query below returns no rows in maria-5.3 even though the subquery returns an empty result and therefore the ALL predicate should evaluate to TRUE. Not influenced by optimizer_switches. Not repeatable with maria-5.2, mysql-5.1. Also please check the = ALL form, as it appears to return an incorrect result as well .

      test case:

      CREATE TABLE t1 (a int);
      INSERT INTO t1 VALUES (0);

      CREATE TABLE t2 ( b int, KEY (b) );
      INSERT INTO t2 VALUES (0);

      CREATE TABLE t3 ( c int) ;
      INSERT INTO t3 VALUES (6);

      CREATE TABLE t4 (d int) ;

      SELECT * FROM t1
      WHERE t1.a < ALL (
      SELECT b FROM t2
      WHERE EXISTS (
      SELECT t3.c
      FROM t4
      LEFT JOIN t3 ON t3.c != 0
      )
      );

      explain:

      1 PRIMARY t1 system NULL NULL NULL NULL 1  
      2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
      3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables

      expected result:

      ------

      a

      ------

      0

      ------

      optimizer switch:

      index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on

      bzr version-info
      revision-id: <email address hidden>
      date: 2011-07-20 11:56:28 +0400
      build-date: 2011-07-20 15:58:31 +0300
      revno: 3123
      branch-nick: maria-5.3

      Attachments

        Activity

          People

            timour Timour Katchaounov (Inactive)
            philipstoev Philip Stoev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 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.