MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:ramil Date:September 29 2005 2:34pm
Subject:bk commit into 5.0 tree (ramil:1.2024) BUG#13545
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram 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.2024 05/09/29 19:34:21 ramil@stripped +3 -0
  fix for bug #13545: Server crash caused by select query.

  sql/sql_base.cc
    1.307 05/09/29 19:34:14 ramil@stripped +6 -9
    fix for bug #13545: Server crash caused by select query.
    - compare table qualifier only with tables which are not nested joins.
    - perform recursion accordingly.
    - DBUG_ASSERT(table_list->table); added before the find_field_in_table() call.

  mysql-test/t/join_nested.test
    1.11 05/09/29 19:34:14 ramil@stripped +31 -0
    fix for bug #13545: Server crash caused by select query.

  mysql-test/r/join_nested.result
    1.15 05/09/29 19:34:14 ramil@stripped +28 -0
    fix for bug #13545: Server crash caused by select query.

# 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:	ramil
# Host:	gw.mysql.r18.ru
# Root:	/usr/home/ram/work/mysql-5.0

--- 1.306/sql/sql_base.cc	2005-09-27 08:15:46 +05:00
+++ 1.307/sql/sql_base.cc	2005-09-29 19:34:14 +05:00
@@ -2988,7 +2988,7 @@
     are the same as the table reference we are going to search for the field.
 
     We exclude from the test below NATURAL/USING joins and any nested join
-    that is an operand of NATURAL/USING join, because each column in such
+    because each column in such
     joins may potentially originate from a different table. However, base
     tables and views that are under some NATURAL/USING join are searched
     as usual base tables/views.
@@ -3001,8 +3001,8 @@
     TODO: Ensure that table_name, db_name and tables->db always points to
           something !
   */
-  if (/* Exclude natural joins and nested joins underlying natural joins. */
-      (!(table_list->nested_join && table_list->join_columns) ||
+  if (/* Exclude nested joins. */
+      (!table_list->nested_join ||
        /* Include merge views and information schema tables. */
        table_list->field_translation) &&
       /*
@@ -3025,13 +3025,10 @@
                                  register_tree_change)))
       *actual_table= table_list;
   }
-  else if (!(table_list->nested_join && table_list->join_columns))
+  else if (!table_list->nested_join)
   {
-    /*
-      'table_list' is a stored table. It is so because the only type of nested
-      join passed to this procedure is a NATURAL/USING join or an operand of a
-      NATURAL/USING join.
-    */
+    /* 'table_list' is a stored table. */
+    DBUG_ASSERT(table_list->table);
     if ((fld= find_field_in_table(thd, table_list->table, name, length,
                                   check_grants_table, allow_rowid,
                                   cached_field_index_ptr)))

--- 1.14/mysql-test/r/join_nested.result	2005-08-23 20:08:00 +05:00
+++ 1.15/mysql-test/r/join_nested.result	2005-09-29 19:34:14 +05:00
@@ -1375,3 +1375,31 @@
 6	9900
 DROP VIEW v1,v2;
 DROP TABLE t1,t2,t3,t4;
+CREATE TABLE t1(a int);
+CREATE TABLE t2(b int);
+CREATE TABLE t3(c int, d int);
+CREATE TABLE t4(d int);
+CREATE TABLE t5(e int, f int);
+CREATE TABLE t6(f int);
+CREATE VIEW v1 AS 
+SELECT e FROM t5 JOIN t6 ON t5.e=t6.f;
+CREATE VIEW v2 AS 
+SELECT e FROM t5 NATURAL JOIN t6;
+SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
+a
+SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
+ERROR 42S22: Unknown column 't1.x' in 'field list'
+SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
+a
+SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
+ERROR 42S22: Unknown column 't1.x' in 'field list'
+SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+e
+SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+ERROR 42S22: Unknown column 'v1.x' in 'field list'
+SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+e
+SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+ERROR 42S22: Unknown column 'v2.x' in 'field list'
+DROP VIEW v1, v2;
+DROP TABLE t1, t2, t3, t4, t5, t6;

--- 1.10/mysql-test/t/join_nested.test	2005-08-23 20:08:01 +05:00
+++ 1.11/mysql-test/t/join_nested.test	2005-09-29 19:34:14 +05:00
@@ -801,3 +801,34 @@
 
 DROP VIEW v1,v2;
 DROP TABLE t1,t2,t3,t4;
+
+#
+# Bug #13545: problem with NATURAL/USING joins.
+#
+
+CREATE TABLE t1(a int);
+CREATE TABLE t2(b int);
+CREATE TABLE t3(c int, d int);
+CREATE TABLE t4(d int);
+CREATE TABLE t5(e int, f int);
+CREATE TABLE t6(f int);
+CREATE VIEW v1 AS 
+  SELECT e FROM t5 JOIN t6 ON t5.e=t6.f;
+CREATE VIEW v2 AS 
+  SELECT e FROM t5 NATURAL JOIN t6;
+
+SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
+--error 1054
+SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
+SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
+--error 1054
+SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
+SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+--error 1054
+SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+--error 1054
+SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+
+DROP VIEW v1, v2;
+DROP TABLE t1, t2, t3, t4, t5, t6;
Thread
bk commit into 5.0 tree (ramil:1.2024) BUG#13545ramil29 Sep