List:Internals« Previous MessageNext Message »
From:igor Date:June 6 2005 3:05pm
Subject:bk commit into 5.0 tree (igor:1.1952) BUG#6866
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.1952 05/06/06 06:05:11 igor@stripped +3 -0
  sp.test, sp.result:
    Added a test case for bug #6866.
  sql_select.cc:
    Fixed bug #6866.
    Bug was due to the fact that on_expr was not backed up
    for the second execution of the stored procedure.

  mysql-test/t/sp.test
    1.121 05/06/06 06:04:31 igor@stripped +44 -0
    Added a test case for bug #6866.

  mysql-test/r/sp.result
    1.127 05/06/06 06:03:49 igor@stripped +40 -0
    Added a test case for bug #6866.

  sql/sql_select.cc
    1.333 05/06/06 06:00:05 igor@stripped +2 -0
    Fixed bug #6866.
    Bug was due to the fact that on_expr was not backed up
    for the second execution of the stored procedure.

# 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-0

--- 1.332/sql/sql_select.cc	Thu Jun  2 02:01:48 2005
+++ 1.333/sql/sql_select.cc	Mon Jun  6 06:00:05 2005
@@ -7374,6 +7374,8 @@
     }
     else
     {
+      if (!(table->prep_on_expr))
+        table->prep_on_expr= table->on_expr;
       used_tables= table->table->map;
       if (conds)
         not_null_tables= conds->not_null_tables();

--- 1.126/mysql-test/r/sp.result	Wed Jun  1 03:17:38 2005
+++ 1.127/mysql-test/r/sp.result	Mon Jun  6 06:03:49 2005
@@ -3138,4 +3138,44 @@
 x
 3
 drop procedure bug10961|
+DROP PROCEDURE IF EXISTS bug6866|
+DROP VIEW IF EXISTS tv|
+Warnings:
+Note	1051	Unknown table 'test.tv'
+DROP TABLE IF EXISTS tt1,tt2,tt3|
+Warnings:
+Note	1051	Unknown table 'tt1'
+Note	1051	Unknown table 'tt2'
+Note	1051	Unknown table 'tt3'
+CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))|
+CREATE TABLE tt2 (a2 int, data2 varchar(10))|
+CREATE TABLE tt3 (a3 int, data3 varchar(10))|
+INSERT INTO tt1 VALUES (1, 1, 4, 'xx')|
+INSERT INTO tt2 VALUES (1, 'a')|
+INSERT INTO tt2 VALUES (2, 'b')|
+INSERT INTO tt2 VALUES (3, 'c')|
+INSERT INTO tt3 VALUES (4, 'd')|
+INSERT INTO tt3 VALUES (5, 'e')|
+INSERT INTO tt3 VALUES (6, 'f')|
+CREATE VIEW tv AS
+SELECT tt1.*, tt2.data2, tt3.data3
+FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2
+LEFT JOIN tt3 ON tt1.a3 = tt3.a3
+ORDER BY tt1.a1, tt2.a2, tt3.a3|
+CREATE PROCEDURE bug6866 (_a1 int)
+BEGIN
+SELECT * FROM tv WHERE a1 = _a1;
+END|
+CALL bug6866(1)|
+a1	a2	a3	data	data2	data3
+1	1	4	xx	a	d
+CALL bug6866(1)|
+a1	a2	a3	data	data2	data3
+1	1	4	xx	a	d
+CALL bug6866(1)|
+a1	a2	a3	data	data2	data3
+1	1	4	xx	a	d
+DROP PROCEDURE bug6866;
+DROP VIEW tv|
+DROP TABLE tt1, tt2, tt3|
 drop table t1,t2;

--- 1.120/mysql-test/t/sp.test	Wed Jun  1 03:17:38 2005
+++ 1.121/mysql-test/t/sp.test	Mon Jun  6 06:04:31 2005
@@ -3848,6 +3848,50 @@
 
 drop procedure bug10961|
 
+#
+# BUG #6866: Second call of a stored procedure using a view with on expressions
+#
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS bug6866|
+--enable_warnings
+
+DROP VIEW IF EXISTS tv|
+DROP TABLE IF EXISTS tt1,tt2,tt3|
+
+CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))|
+CREATE TABLE tt2 (a2 int, data2 varchar(10))|
+CREATE TABLE tt3 (a3 int, data3 varchar(10))|
+
+INSERT INTO tt1 VALUES (1, 1, 4, 'xx')|
+
+INSERT INTO tt2 VALUES (1, 'a')|
+INSERT INTO tt2 VALUES (2, 'b')|
+INSERT INTO tt2 VALUES (3, 'c')|
+
+INSERT INTO tt3 VALUES (4, 'd')|
+INSERT INTO tt3 VALUES (5, 'e')|
+INSERT INTO tt3 VALUES (6, 'f')|
+
+CREATE VIEW tv AS
+SELECT tt1.*, tt2.data2, tt3.data3
+  FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2
+         LEFT JOIN tt3 ON tt1.a3 = tt3.a3
+    ORDER BY tt1.a1, tt2.a2, tt3.a3|
+
+CREATE PROCEDURE bug6866 (_a1 int)
+BEGIN
+SELECT * FROM tv WHERE a1 = _a1;
+END|
+
+CALL bug6866(1)|
+CALL bug6866(1)|
+CALL bug6866(1)|
+
+DROP PROCEDURE bug6866;
+
+DROP VIEW tv|
+DROP TABLE tt1, tt2, tt3|
 
 #
 # BUG#NNNN: New bug synopsis
Thread
bk commit into 5.0 tree (igor:1.1952) BUG#6866igor6 Jun