List:Internals« Previous MessageNext Message »
From:Sergey Petrunia Date:November 2 2005 5:05am
Subject:bk commit into 5.0 tree (sergefp:1.1959) BUG#14026
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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
  1.1959 05/11/02 07:05:19 sergefp@stripped +3 -0
  BUG#14026: When doing the end-of-prepare fix up for TABLE_LISTs used in the PS, do the
fixup
  for underlying tables of a merge VIEWs, too.

  sql/sql_lex.cc
    1.173 05/11/02 07:05:06 sergefp@stripped +30 -10
    BUG#14026: When doing the end-of-prepare fix up for TABLE_LISTs used in the PS, do the
fixup
    for underlying tables of a merge VIEWs, too.

  mysql-test/t/view.test
    1.118 05/11/02 07:05:06 sergefp@stripped +23 -1
    Testcase for BUG#14026

  mysql-test/r/view.result
    1.127 05/11/02 07:05:06 sergefp@stripped +22 -1
    Testcase for BUG#14026

# 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:	newbox.mylan
# Root:	/home/psergey/mysql-5.0-bug14026-r2

--- 1.172/sql/sql_lex.cc	2005-10-21 05:01:32 +04:00
+++ 1.173/sql/sql_lex.cc	2005-11-02 07:05:06 +03:00
@@ -2038,6 +2038,35 @@
 
 
 /*
+  Do end-of-prepare fixup for list of tables and their merge-VIEWed tables
+
+  SYNOPSIS
+    fix_prepare_info_in_table_list()
+      thd  Thread handle
+      tbl  List of tables to process
+
+  DESCRIPTION
+    Perform end-end-of prepare fixup for list of tables, if any of the tables
+    is a merge-algorithm VIEW, recursively fix up its underlying tables as
+    well.
+
+*/
+
+static void fix_prepare_info_in_table_list(THD *thd, TABLE_LIST *tbl)
+{
+  for (; tbl; tbl= tbl->next_local)
+  {
+    if (tbl->on_expr)
+    {
+      tbl->prep_on_expr= tbl->on_expr;
+      tbl->on_expr= tbl->on_expr->copy_andor_structure(thd);
+    }
+    fix_prepare_info_in_table_list(thd, tbl->merge_underlying_list);
+  }
+}
+
+
+/*
   fix some structures at the end of preparation
 
   SYNOPSIS
@@ -2056,16 +2085,7 @@
       prep_where= *conds;
       *conds= where= prep_where->copy_andor_structure(thd);
     }
-    for (TABLE_LIST *tbl= (TABLE_LIST *)table_list.first;
-         tbl;
-         tbl= tbl->next_local)
-    {
-      if (tbl->on_expr)
-      {
-        tbl->prep_on_expr= tbl->on_expr;
-        tbl->on_expr= tbl->on_expr->copy_andor_structure(thd);
-      }
-    }
+    fix_prepare_info_in_table_list(thd, (TABLE_LIST *)table_list.first);
   }
 }
 

--- 1.126/mysql-test/r/view.result	2005-10-28 16:50:29 +04:00
+++ 1.127/mysql-test/r/view.result	2005-11-02 07:05:06 +03:00
@@ -1,4 +1,4 @@
-drop table if exists t1,t2,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
+drop table if exists t1,t2,t3,t4,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
 drop view if exists t1,t2,`t1a``b`,v1,v2,v3,v4,v5,v6;
 drop database if exists mysqltest;
 use test;
@@ -2323,3 +2323,24 @@
 1	PRIMARY	t3	ALL	NULL	NULL	NULL	NULL	3	Using where
 DROP VIEW v1,v2;
 DROP TABLE t1,t2,t3;
+create table t1 (x int, y int);
+create table t2 (x int, y int, z int);
+create table t3 (x int, y int, z int);
+create table t4 (x int, y int, z int);
+create view v1 as
+select t1.x
+from (
+(t1 join t2 on ((t1.y = t2.y))) 
+join 
+(t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z))
+);
+prepare stmt1 from "select count(*) from v1 where x = ?";
+set @parm1=1;
+execute stmt1 using @parm1;
+count(*)
+0
+execute stmt1 using @parm1;
+count(*)
+0
+drop view v1;
+drop table t1,t2,t3,t4;

--- 1.117/mysql-test/t/view.test	2005-10-28 14:11:24 +04:00
+++ 1.118/mysql-test/t/view.test	2005-11-02 07:05:06 +03:00
@@ -1,5 +1,5 @@
 --disable_warnings
-drop table if exists t1,t2,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
+drop table if exists t1,t2,t3,t4,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
 drop view if exists t1,t2,`t1a``b`,v1,v2,v3,v4,v5,v6;
 drop database if exists mysqltest;
 --enable_warnings
@@ -2189,4 +2189,26 @@
 DROP VIEW v1,v2;
 DROP TABLE t1,t2,t3;
 
+#
+# BUG#14026 Crash on second PS execution when using views
+#
+create table t1 (x int, y int);
+create table t2 (x int, y int, z int);
+create table t3 (x int, y int, z int);
+create table t4 (x int, y int, z int);
+
+create view v1 as
+select t1.x
+from (
+  (t1 join t2 on ((t1.y = t2.y))) 
+  join 
+  (t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z))
+);
 
+prepare stmt1 from "select count(*) from v1 where x = ?";
+set @parm1=1;
+
+execute stmt1 using @parm1;
+execute stmt1 using @parm1;
+drop view v1;
+drop table t1,t2,t3,t4;
Thread
bk commit into 5.0 tree (sergefp:1.1959) BUG#14026Sergey Petrunia2 Nov