List:Commits« Previous MessageNext Message »
From:igor Date:September 25 2006 1:46pm
Subject:bk commit into 5.0 tree (igor:1.2278)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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 06:46:15-07:00, igor@stripped +3 -0
  Merge rurik.mysql.com:/home/igor/mysql-4.1-opt
  into  rurik.mysql.com:/home/igor/mysql-5.0-opt
  MERGE: 1.1616.2144.220

  mysql-test/r/subselect.result@stripped, 2006-09-25 06:46:12-07:00, igor@stripped +2 -2
    Manual merge
    MERGE: 1.67.1.116

  mysql-test/t/subselect.test@stripped, 2006-09-25 06:46:12-07:00, igor@stripped +2 -2
    Manual merge
    MERGE: 1.58.1.102

  sql/item.cc@stripped, 2006-09-25 06:46:12-07:00, igor@stripped +1 -1
    Manual merge
    MERGE: 1.58.1.175

# 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-5.0-opt/RESYNC

--- 1.234/sql/item.cc	2006-09-25 06:46:25 -07:00
+++ 1.235/sql/item.cc	2006-09-25 06:46:25 -07:00
@@ -1182,6 +1182,7 @@
     split_sum_func(thd, ref_pointer_array, fields);
   }
   else if ((type() == SUM_FUNC_ITEM || (used_tables() & ~PARAM_TABLE_BIT)) &&
+           type() != SUBSELECT_ITEM &&
            (type() != REF_ITEM ||
            ((Item_ref*)this)->ref_type() == Item_ref::VIEW_REF))
   {

--- 1.160/mysql-test/r/subselect.result	2006-09-25 06:46:25 -07:00
+++ 1.161/mysql-test/r/subselect.result	2006-09-25 06:46:25 -07:00
@@ -1160,7 +1160,7 @@
 PRIMARY KEY  (Code)
 ) ENGINE=MyISAM;
 INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
+INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
 select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2  where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent);
 Continent	Name	Population
 Oceania	Sydney	3276207
@@ -2512,7 +2512,7 @@
 ) ENGINE=MyISAM;
 INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
 INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
+INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
 INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
 /*!40000 ALTER TABLE t1 ENABLE KEYS */;
 SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
@@ -2966,6 +2966,42 @@
 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;
 create table t1 (df decimal(5,1));
 insert into t1 values(1.1);
 insert into t1 values(2.2);

--- 1.128/mysql-test/t/subselect.test	2006-09-25 06:46:25 -07:00
+++ 1.129/mysql-test/t/subselect.test	2006-09-25 06:46:25 -07:00
@@ -665,7 +665,7 @@
 ) ENGINE=MyISAM;
 
 INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
+INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
 
 select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2  where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent); 
 
@@ -1526,7 +1526,7 @@
 ) ENGINE=MyISAM;
 INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
 INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
+INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
 INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
 /*!40000 ALTER TABLE t1 ENABLE KEYS */;
 SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
@@ -1917,6 +1917,43 @@
             ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
 
 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 5.0 tree (igor:1.2278)igor25 Sep