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

LP:817384 - Wrong result with outer join + subquery in ON clause +unique key in maria-5.3

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      Not repeatable in maria-5.2,maria-5.1,mysql-5.5

      Even after the fix for 813447, the following query:

      SELECT t2.b FROM t1
      LEFT JOIN t2
      ON t1.col_int_nokey = t2.a
      AND ( t2.b , t1.b ) IN ( SELECT 'c' , 'd' );

      returns "a" which is wrong since the second part of the ON predicate is FALSE for all rows.

      explain:

      1 PRIMARY t1 system NULL NULL NULL NULL 1  
      1 PRIMARY t2 const PRIMARY PRIMARY 4 const 1  
      2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used

      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-25 21:52:15 -0700
      build-date: 2011-07-28 11:26:14 +0300
      revno: 3005
      branch-nick: maria-5.2

      test case:

      CREATE TABLE t1 ( c int NOT NULL , b varchar(32) NOT NULL ) ;
      INSERT INTO t1 VALUES (1,'b');

      CREATE TABLE t2 ( a int NOT NULL , b varchar(32) NOT NULL , PRIMARY KEY (a)) ;
      INSERT INTO t2 VALUES (1,'a');

      SELECT t2.b FROM t1
      LEFT JOIN t2
      ON t1.c = t2.a
      AND ( t2.b , t1.b ) IN (SELECT 'c' , 'd' );

      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.