Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja 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.2112 06/03/25 14:27:47 konstantin@stripped +3 -0
A fix and a test case for Bug#15683 "crash, Function on nested
VIEWs, Prepared statement": we didn't mark the nested views
as 'prelockng placeholders' when building the prelocking list.
This resulted in these views being processed (merged, materialized)
before they are actually used.
sql/sql_view.cc
1.84 06/03/25 14:27:29 konstantin@stripped +1 -0
When initializing tables used in a view, inherite
its 'prelocking_placeholder' flag. This flag is set when we're
opening the view in order to build the prelocking list for a query.
In this case we should only calculate the list to
prelock, and should not merge neither this view nor any of the
nested views, of there are any. The flag is used to indicate this
mode.
mysql-test/t/sp-prelocking.test
1.4 06/03/25 14:27:29 konstantin@stripped +31 -0
Add a test case for Bug#15683
mysql-test/r/sp-prelocking.result
1.4 06/03/25 14:27:29 konstantin@stripped +23 -0
Test results fixed (Bug#15683)
# 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: konstantin
# Host: dragonfly.local
# Root: /opt/local/work/mysql-5.0-15683
--- 1.83/sql/sql_view.cc 2006-03-10 03:44:02 +03:00
+++ 1.84/sql/sql_view.cc 2006-03-25 14:27:29 +03:00
@@ -938,6 +938,7 @@
tbl->skip_temporary= 1;
tbl->belong_to_view= top_view;
tbl->referencing_view= table;
+ tbl->prelocking_placeholder= table->prelocking_placeholder;
/*
First we fill want_privilege with SELECT_ACL (this is needed for the
tables which belongs to view subqueries and temporary table views,
--- 1.3/mysql-test/r/sp-prelocking.result 2006-01-26 19:54:27 +03:00
+++ 1.4/mysql-test/r/sp-prelocking.result 2006-03-25 14:27:29 +03:00
@@ -214,3 +214,26 @@
drop function f2;
drop function f3;
drop procedure sp1;
+drop table if exists t1;
+drop view if exists v1, v2, v3;
+drop function if exists bug15683;
+create table t1 (f1 bigint, f2 varchar(20), f3 bigint);
+insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1;
+create view v1 as select 1 from t1 union all select 1;
+create view v2 as select 1 from v1;
+create view v3 as select 1 as f1 from v2;
+create function bug15683() returns bigint
+begin
+return (select count(*) from v3);
+end|
+prepare stmt from "select bug15683()";
+execute stmt;
+bug15683()
+2
+execute stmt;
+bug15683()
+2
+deallocate prepare stmt;
+drop table t1;
+drop view v1, v2, v3;
+drop function bug15683;
--- 1.3/mysql-test/t/sp-prelocking.test 2006-01-26 19:54:28 +03:00
+++ 1.4/mysql-test/t/sp-prelocking.test 2006-03-25 14:27:29 +03:00
@@ -241,3 +241,34 @@
drop function f3;
drop procedure sp1;
+#
+# Bug#15683 "crash, Function on nested VIEWs, Prepared statement"
+# Check that when creating the prelocking list a nested view
+# is not merged until it's used.
+#
+--disable_warnings
+drop table if exists t1;
+drop view if exists v1, v2, v3;
+drop function if exists bug15683;
+--enable_warnings
+create table t1 (f1 bigint, f2 varchar(20), f3 bigint);
+insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1;
+create view v1 as select 1 from t1 union all select 1;
+create view v2 as select 1 from v1;
+create view v3 as select 1 as f1 from v2;
+
+delimiter |;
+create function bug15683() returns bigint
+begin
+return (select count(*) from v3);
+end|
+delimiter ;|
+
+prepare stmt from "select bug15683()";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+drop table t1;
+drop view v1, v2, v3;
+drop function bug15683;
+
| Thread |
|---|
| • bk commit into 5.0 tree (konstantin:1.2112) BUG#15683 | konstantin | 25 Mar |