MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:igor Date:September 25 2006 12:24pm
Subject:bk commit into 4.1 tree (igor:1.2572) BUG#21853
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of igor. When igor 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-09-25 05:24:07-07:00, igor@stripped +3 -0
  Fixed bug #21853: assert failure for a grouping query with
  an ALL/ANY quantified subquery in HAVING.
  The Item::split_sum_func2 method should not create Item_ref
  for objects of any class derived from Item_subselect.

  mysql-test/r/subselect.result@stripped, 2006-09-25 05:24:04-07:00, igor@stripped +36 -0
    Added a test case for bug #21853.

  mysql-test/t/subselect.test@stripped, 2006-09-25 05:24:04-07:00, igor@stripped +37 -0
    Added a test case for bug #21853.

  sql/item.cc@stripped, 2006-09-25 05:24:04-07:00, igor@stripped +1 -0
    Fixed bug #21853: assert failure for a grouping query with
    an ALL/ANY quantified subquery in HAVING.
    The Item::split_sum_func2 method should not create Item_ref
    for objects of any class derived from Item_subselect.

# 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:	igor
# Host:	rurik.mysql.com
# Root:	/home/igor/mysql-4.1-opt

--- 1.232/sql/item.cc	2006-09-25 05:24:12 -07:00
+++ 1.233/sql/item.cc	2006-09-25 05:24:12 -07:00
@@ -387,6 +387,7 @@
   }
   else if ((type() == SUM_FUNC_ITEM ||
             (used_tables() & ~PARAM_TABLE_BIT)) &&
+           type() != SUBSELECT_ITEM &&
            type() != REF_ITEM)
   {
     /*

--- 1.182/mysql-test/r/subselect.result	2006-09-25 05:24:12 -07:00
+++ 1.183/mysql-test/r/subselect.result	2006-09-25 05:24:12 -07:00
@@ -2946,3 +2946,39 @@
 a	a	b
 10	1	359
 drop table t1,t2;
+CREATE TABLE t1 (                  
+field1 int NOT NULL,                 
+field2 int NOT NULL,                 
+field3 int NOT NULL,                 
+PRIMARY KEY  (field1,field2,field3)  
+);
+CREATE TABLE t2 (             
+fieldA int NOT NULL,            
+fieldB int NOT NULL,            
+PRIMARY KEY  (fieldA,fieldB)     
+);
+INSERT INTO t1 VALUES
+(1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
+INSERT INTO t2 VALUES (1,1), (1,2), (1,3);
+SELECT field1, field2, COUNT(*)
+FROM t1 GROUP BY field1, field2;
+field1	field2	COUNT(*)
+1	1	2
+1	2	3
+1	3	1
+SELECT field1, field2
+FROM  t1
+GROUP BY field1, field2
+HAVING COUNT(*) >= ALL (SELECT fieldB 
+FROM t2 WHERE fieldA = field1);
+field1	field2
+1	2
+SELECT field1, field2
+FROM  t1
+GROUP BY field1, field2
+HAVING COUNT(*) < ANY (SELECT fieldB 
+FROM t2 WHERE fieldA = field1);
+field1	field2
+1	1
+1	3
+DROP TABLE t1, t2;

--- 1.159/mysql-test/t/subselect.test	2006-09-25 05:24:12 -07:00
+++ 1.160/mysql-test/t/subselect.test	2006-09-25 05:24:12 -07:00
@@ -1911,4 +1911,41 @@
 
 drop table t1,t2;
 
+#
+# Bug #21853: assert failure for a grouping query with
+#             an ALL/ANY quantified subquery in HAVING 
+#
+
+CREATE TABLE t1 (                  
+  field1 int NOT NULL,                 
+  field2 int NOT NULL,                 
+  field3 int NOT NULL,                 
+  PRIMARY KEY  (field1,field2,field3)  
+);
+CREATE TABLE t2 (             
+  fieldA int NOT NULL,            
+  fieldB int NOT NULL,            
+  PRIMARY KEY  (fieldA,fieldB)     
+); 
+
+INSERT INTO t1 VALUES
+  (1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
+INSERT INTO t2 VALUES (1,1), (1,2), (1,3);
+
+SELECT field1, field2, COUNT(*)
+  FROM t1 GROUP BY field1, field2;
+
+SELECT field1, field2
+  FROM  t1
+    GROUP BY field1, field2
+      HAVING COUNT(*) >= ALL (SELECT fieldB 
+                                FROM t2 WHERE fieldA = field1);
+SELECT field1, field2
+  FROM  t1
+    GROUP BY field1, field2
+      HAVING COUNT(*) < ANY (SELECT fieldB 
+                               FROM t2 WHERE fieldA = field1);
+
+DROP TABLE t1, t2;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (igor:1.2572) BUG#21853igor25 Sep