List:Commits« Previous MessageNext Message »
From:Neeraj Bisht Date:December 11 2012 12:31pm
Subject:bzr push into mysql-trunk branch (neeraj.x.bisht:5209 to 5210) Bug#13992148
View as plain text  
 5210 Neeraj Bisht	2012-12-11 [merge]
      Bug#13992148 - IMPROPER EXECUTION OF QUERY WITH "IN (...UNION...)" 
      
      
      Problem:
      A query with IN clause and have UNION operator on left, 	
      executes improperly.
      
      
      Analysis:-
      
      In case of IN clause, we check whether the number of column on the left and 
      right expression of IN are same or not.
      
      After that we are fixing the field(prepare the subselect engine)of left 
      expression of IN clause.
      
      In case of UNION operator we got the number of column after we prepare 
      subselect_union_engine.Hence we dont have the correct value of number of 
      column, so DEBUG_ASSERT got failed.
      
      
      Possible Solution:-
      First we check fix the field of left side expression and then check the number 
      of column.
     @ mysql-test/include/subquery_sj.inc
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_all.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_all_bka.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_all_bka_nixbnl.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_all_bkaunique.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_dupsweed.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_dupsweed_bka.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_dupsweed_bkaunique.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_firstmatch.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_firstmatch_bka.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_firstmatch_bkaunique.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_loosescan.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_loosescan_bka.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_loosescan_bkaunique.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_mat.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_mat_bka.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_mat_bka_nixbnl.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_mat_bkaunique.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_mat_nosj.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_none.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_none_bka.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_none_bka_nixbnl.result
        change test case for bug 13992148.
     @ mysql-test/r/subquery_sj_none_bkaunique.result
        change test case for bug 13992148.
     @ sql/sql_resolver.cc
        First we check fix the field of left side expression and then 
        check the number of column.

    modified:
      mysql-test/include/subquery_sj.inc
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bka_nixbnl.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
      sql/sql_resolver.cc
 5209 Akhila Maddukuri	2012-12-11
      removed an out-of-bound test-case

    modified:
      mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result
      mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test
=== modified file 'mysql-test/include/subquery_sj.inc'
--- a/mysql-test/include/subquery_sj.inc	2012-09-14 13:19:41 +0000
+++ b/mysql-test/include/subquery_sj.inc	2012-12-11 12:14:04 +0000
@@ -2545,7 +2545,7 @@ CREATE TABLE BB (
   varchar_nokey varchar(1) NOT NULL
 );
 INSERT INTO BB VALUES ('i'),('t');
--- error ER_OPERAND_COLUMNS
+-- error ER_BAD_FIELD_ERROR
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
                                 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_all.result'
--- a/mysql-test/r/subquery_sj_all.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_all.result	2012-12-11 12:29:58 +0000
@@ -5911,7 +5911,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_all_bka.result'
--- a/mysql-test/r/subquery_sj_all_bka.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_all_bka.result	2012-12-11 12:29:58 +0000
@@ -5914,7 +5914,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_all_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_all_bka_nixbnl.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_all_bka_nixbnl.result	2012-12-11 12:29:58 +0000
@@ -5924,7 +5924,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_all_bkaunique.result'
--- a/mysql-test/r/subquery_sj_all_bkaunique.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_all_bkaunique.result	2012-12-11 12:29:58 +0000
@@ -5915,7 +5915,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_dupsweed.result'
--- a/mysql-test/r/subquery_sj_dupsweed.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed.result	2012-12-11 12:29:58 +0000
@@ -5870,7 +5870,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka.result	2012-12-11 12:29:58 +0000
@@ -5871,7 +5871,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result	2012-12-11 12:29:58 +0000
@@ -5881,7 +5881,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bkaunique.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bkaunique.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bkaunique.result	2012-12-11 12:29:58 +0000
@@ -5872,7 +5872,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_firstmatch.result'
--- a/mysql-test/r/subquery_sj_firstmatch.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch.result	2012-12-11 12:29:58 +0000
@@ -5869,7 +5869,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka.result	2012-12-11 12:29:58 +0000
@@ -5870,7 +5870,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result	2012-12-11 12:29:58 +0000
@@ -5882,7 +5882,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bkaunique.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bkaunique.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bkaunique.result	2012-12-11 12:29:58 +0000
@@ -5871,7 +5871,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_loosescan.result'
--- a/mysql-test/r/subquery_sj_loosescan.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_loosescan.result	2012-12-11 12:29:58 +0000
@@ -5871,7 +5871,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_loosescan_bka.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka.result	2012-12-11 12:29:58 +0000
@@ -5872,7 +5872,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result	2012-12-11 12:29:58 +0000
@@ -5882,7 +5882,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_loosescan_bkaunique.result'
--- a/mysql-test/r/subquery_sj_loosescan_bkaunique.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bkaunique.result	2012-12-11 12:29:58 +0000
@@ -5873,7 +5873,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_mat.result'
--- a/mysql-test/r/subquery_sj_mat.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_mat.result	2012-12-11 12:29:58 +0000
@@ -5998,7 +5998,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_mat_bka.result'
--- a/mysql-test/r/subquery_sj_mat_bka.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_mat_bka.result	2012-12-11 12:29:58 +0000
@@ -5999,7 +5999,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_mat_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_mat_bka_nixbnl.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_mat_bka_nixbnl.result	2012-12-11 12:29:58 +0000
@@ -5987,7 +5987,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_mat_bkaunique.result'
--- a/mysql-test/r/subquery_sj_mat_bkaunique.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_mat_bkaunique.result	2012-12-11 12:29:58 +0000
@@ -6000,7 +6000,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_mat_nosj.result'
--- a/mysql-test/r/subquery_sj_mat_nosj.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_mat_nosj.result	2012-12-11 12:29:58 +0000
@@ -5830,7 +5830,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_none.result'
--- a/mysql-test/r/subquery_sj_none.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_none.result	2012-12-11 12:29:58 +0000
@@ -5870,7 +5870,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_none_bka.result'
--- a/mysql-test/r/subquery_sj_none_bka.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_none_bka.result	2012-12-11 12:29:58 +0000
@@ -5871,7 +5871,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_none_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_none_bka_nixbnl.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_none_bka_nixbnl.result	2012-12-11 12:29:58 +0000
@@ -5870,7 +5870,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'mysql-test/r/subquery_sj_none_bkaunique.result'
--- a/mysql-test/r/subquery_sj_none_bkaunique.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/subquery_sj_none_bkaunique.result	2012-12-11 12:29:58 +0000
@@ -5872,7 +5872,7 @@ INSERT INTO BB VALUES ('i'),('t');
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey
 FROM BB);
-ERROR 21000: Operand should contain 2 column(s)
+ERROR 42S22: Unknown column 'OUTR' in 'IN/ALL/ANY subquery'
 SELECT varchar_nokey FROM C
 WHERE (varchar_nokey, OUTR) IN (SELECT varchar_nokey, varchar_nokey
 FROM BB);

=== modified file 'sql/sql_resolver.cc'
--- a/sql/sql_resolver.cc	2012-11-24 17:17:47 +0000
+++ b/sql/sql_resolver.cc	2012-12-11 12:29:58 +0000
@@ -551,6 +551,19 @@ static bool resolve_subquery(THD *thd, J
 
   if (in_predicate)
   {
+    DBUG_ASSERT(select_lex == thd->lex->current_select);
+    thd->lex->current_select= outer;
+    char const *save_where= thd->where;
+    thd->where= "IN/ALL/ANY subquery";
+
+    bool result= !in_predicate->left_expr->fixed &&
+                  in_predicate->left_expr->fix_fields(thd,
+                                                     &in_predicate->left_expr);
+    thd->lex->current_select= select_lex;
+    thd->where= save_where;
+    if (result)
+      DBUG_RETURN(TRUE); /* purecov: deadcode */
+
     /*
       Check if the left and right expressions have the same # of
       columns, i.e. we don't have a case like 
@@ -565,18 +578,6 @@ static bool resolve_subquery(THD *thd, J
       DBUG_RETURN(TRUE);
     }
 
-    DBUG_ASSERT(select_lex == thd->lex->current_select);
-    thd->lex->current_select= outer;
-    char const *save_where= thd->where;
-    thd->where= "IN/ALL/ANY subquery";
-        
-    bool result= !in_predicate->left_expr->fixed &&
-                  in_predicate->left_expr->fix_fields(thd,
-                                                     &in_predicate->left_expr);
-    thd->lex->current_select= select_lex;
-    thd->where= save_where;
-    if (result)
-      DBUG_RETURN(TRUE); /* purecov: deadcode */
   }
 
   DBUG_PRINT("info", ("Checking if subq can be converted to semi-join"));

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (neeraj.x.bisht:5209 to 5210) Bug#13992148Neeraj Bisht11 Dec