MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:August 24 2006 1:49pm
Subject:bk commit into 4.1 tree (sergefp:1.2542) BUG#16255
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of psergey. When psergey 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-24 17:49:53+04:00, sergefp@stripped +3 -0
  Bug #16255: Subquery in WHERE (the cset by Georgi Kodinov)
   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-24 17:49:45+04:00, sergefp@stripped +11 -0
    Bug #16255: Subquery in where
     - test case

  mysql-test/t/subselect.test@stripped, 2006-08-24 17:49:45+04:00, sergefp@stripped +12 -0
    Bug #16255: Subquery in where
     - test case

  sql/item_subselect.cc@stripped, 2006-08-24 17:49:45+04:00, sergefp@stripped +5 -5
    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).

# 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:	sergefp
# Host:	pslp.mylan
# Root:	/home/psergey/mysql-4.1-bug16255-review

--- 1.180/mysql-test/r/subselect.result	2006-08-24 17:49:57 +04:00
+++ 1.181/mysql-test/r/subselect.result	2006-08-24 17:49:57 +04:00
@@ -2895,3 +2895,14 @@
 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-24 17:49:57 +04:00
+++ 1.158/mysql-test/t/subselect.test	2006-08-24 17:49:57 +04:00
@@ -1861,4 +1861,16 @@
 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-24 17:49:57 +04:00
+++ 1.143/sql/item_subselect.cc	2006-08-24 17:49:57 +04:00
@@ -976,18 +976,18 @@
         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 @@
                   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 @@
                     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 (sergefp:1.2542) BUG#16255Sergey Petrunia24 Aug