MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kgeorge Date:August 8 2006 3:14pm
Subject:bk commit into 4.1 tree (gkodinov:1.2532) BUG#16255
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-08-08 18:14:46+03:00, gkodinov@stripped +3 -0
  Bug #16255: Subquery in where
   Must not use Item_direct_ref in HAVING because it points to
   the new value (witch is not yet calculated for the first row).

  mysql-test/r/subselect.result@stripped, 2006-08-08 18:14:38+03:00, gkodinov@stripped +11 -0
    Bug #16255: Subquery in where
     - test case

  mysql-test/t/subselect.test@stripped, 2006-08-08 18:14:39+03:00, gkodinov@stripped +12 -0
    Bug #16255: Subquery in where
     - test case

  sql/item_subselect.cc@stripped, 2006-08-08 18:14:40+03:00, gkodinov@stripped +5 -5
    Bug #16255: Subquery in where
     - must not use Item_direct_ref in HAVING

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gkodinov
# Host:	macbook.gmz
# Root:	/Users/kgeorge/mysql/work/B16255-4.1-opt

--- 1.180/mysql-test/r/subselect.result	2006-08-08 18:14:58 +03:00
+++ 1.181/mysql-test/r/subselect.result	2006-08-08 18:14:58 +03:00
@@ -2895,3 +2895,14 @@ select * from t1 where NOT(s1 = ALL (sel
 s1
 2
 drop table t1;
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES(26, 1), (48, 2);
+SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a,MAX(b) FROM t1 GROUP BY a);
+a	b
+26	1
+48	2
+SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a + 0,MAX(b) FROM t1 GROUP BY a);
+a	b
+26	1
+48	2
+DROP TABLE t1;

--- 1.157/mysql-test/t/subselect.test	2006-08-08 18:14:58 +03:00
+++ 1.158/mysql-test/t/subselect.test	2006-08-08 18:14:58 +03:00
@@ -1861,4 +1861,16 @@ select * from t1 where NOT(s1+1 = ANY (s
 select * from t1 where (s1 = ALL (select s1/s1 from t1));
 select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
 drop table t1;
+
+#
+# Bug #16255: Subquery in where
+#
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b));
+
+INSERT INTO t1 VALUES(26, 1), (48, 2);
+
+SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a,MAX(b) FROM t1 GROUP BY a);
+SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a + 0,MAX(b) FROM t1 GROUP BY a);
+
+DROP TABLE t1;
 # End of 4.1 tests

--- 1.142/sql/item_subselect.cc	2006-08-08 18:14:58 +03:00
+++ 1.143/sql/item_subselect.cc	2006-08-08 18:14:58 +03:00
@@ -976,18 +976,18 @@ Item_in_subselect::row_value_transformer
         DBUG_RETURN(RES_ERROR);
       Item *item_eq=
         new Item_func_eq(new
-                         Item_direct_ref((*optimizer->get_cache())->
+                         Item_ref((*optimizer->get_cache())->
                                          addr(i),
                                          (char *)"<no matter>",
                                          (char *)in_left_expr_name),
                          new
-                         Item_direct_ref(select_lex->ref_pointer_array + i,
+                         Item_ref(select_lex->ref_pointer_array + i,
                                          (char *)"<no matter>",
                                          (char *)"<list ref>")
                         );
       Item *item_isnull=
         new Item_func_isnull(new
-                             Item_direct_ref( select_lex->
+                             Item_ref( select_lex->
                                               ref_pointer_array+i,
                                               (char *)"<no matter>",
                                               (char *)"<list ref>")
@@ -1000,7 +1000,7 @@ Item_in_subselect::row_value_transformer
                   new
                   Item_is_not_null_test(this,
                                         new
-                                        Item_direct_ref(select_lex->
+                                        Item_ref(select_lex->
                                                         ref_pointer_array + i,
                                                         (char *)"<no matter>",
                                                         (char *)"<list ref>")
@@ -1057,7 +1057,7 @@ Item_in_subselect::row_value_transformer
                     new
                     Item_is_not_null_test(this,
                                           new
-                                          Item_direct_ref(select_lex->
+                                          Item_ref(select_lex->
                                                           ref_pointer_array + i,
                                                           (char *)"<no matter>",
                                                           (char *)"<list ref>")
Thread
bk commit into 4.1 tree (gkodinov:1.2532) BUG#16255kgeorge8 Aug