MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:igor Date:September 27 2005 3:19am
Subject:bk commit into 5.0 tree (igor:1.1996) BUG#13411
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
  1.1996 05/09/26 20:18:59 igor@stripped +4 -0
  sql_base.cc, item.cc:
    Fixed bug #13411.
    Fixed name resolution for non-qualified reference to a view column
    in the HAVING clause.
  view.result, view.test:
    Added a test case for bug #13411.

  sql/sql_base.cc
    1.306 05/09/26 20:15:46 igor@stripped +1 -1
    Fixed bug #13411.
    Fixed name resolution for non-qualified reference to a view column
    in the HAVING clause.

  sql/item.cc
    1.180 05/09/26 20:14:49 igor@stripped +3 -3
    Fixed bug #13411.
    Fixed name resolution for non-qualified reference to a view column
    in the HAVING clause.

  mysql-test/r/view.result
    1.120 05/09/26 20:03:28 igor@stripped +13 -0
    Added a test case for bug #13411.

  mysql-test/t/view.test
    1.112 05/09/26 20:03:03 igor@stripped +15 -0
    Added a test case for bug #13411.

# 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/dev/mysql-5.0-2

--- 1.179/sql/item.cc	Thu Sep 15 12:29:00 2005
+++ 1.180/sql/item.cc	Mon Sep 26 20:14:49 2005
@@ -1687,7 +1687,7 @@
     return 0;
   
   Item_field *item_field= (Item_field*) item;
-  if (item_field->field)
+  if (item_field->field && field)
     return item_field->field == field;
   /*
     We may come here when we are trying to find a function in a GROUP BY
@@ -1701,10 +1701,10 @@
   */
   return (!my_strcasecmp(system_charset_info, item_field->name,
 			 field_name) &&
-	  (!item_field->table_name ||
+	  (!item_field->table_name || !table_name ||
 	   (!my_strcasecmp(table_alias_charset, item_field->table_name,
 			   table_name) &&
-	    (!item_field->db_name ||
+	    (!item_field->db_name || !db_name ||
 	     (item_field->db_name && !strcmp(item_field->db_name,
 					     db_name))))));
 }

--- 1.305/sql/sql_base.cc	Thu Sep 22 13:46:49 2005
+++ 1.306/sql/sql_base.cc	Mon Sep 26 20:15:46 2005
@@ -3459,7 +3459,7 @@
         }
       }
     }
-    else if (!table_name && (item->eq(find,0) ||
+    else if (!table_name && (find->eq(item,0) ||
 			     find->name && item->name &&
 			     !my_strcasecmp(system_charset_info, 
 					    item->name,find->name)))

--- 1.119/mysql-test/r/view.result	Sun Sep 18 20:32:35 2005
+++ 1.120/mysql-test/r/view.result	Mon Sep 26 20:03:28 2005
@@ -2262,3 +2262,16 @@
 1
 DROP TABLE t1;
 DROP VIEW  v1, v2, v3;
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+CREATE VIEW v1 AS SELECT a,b FROM t1;
+SELECT t1.a FROM t1 GROUP BY t1.a HAVING a > 1;
+a
+2
+3
+SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
+a
+2
+3
+DROP VIEW v1;
+DROP TABLE t1;

--- 1.111/mysql-test/t/view.test	Sun Sep 25 06:43:53 2005
+++ 1.112/mysql-test/t/view.test	Mon Sep 26 20:03:03 2005
@@ -2139,3 +2139,18 @@
 
 DROP TABLE t1;
 DROP VIEW  v1, v2, v3;
+
+#
+# Bug #13411: crash when using non-qualified view column in HAVING clause 
+#
+
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+CREATE VIEW v1 AS SELECT a,b FROM t1;
+SELECT t1.a FROM t1 GROUP BY t1.a HAVING a > 1;
+SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+
Thread
bk commit into 5.0 tree (igor:1.1996) BUG#13411igor27 Sep