summaryrefslogtreecommitdiff
path: root/mysql-test/t/ps.test
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.local>2006-08-12 21:06:51 +0400
committerunknown <kostja@bodhi.local>2006-08-12 21:06:51 +0400
commitf68085c4e75a2ef4db33a9500b07ad4e37bf8b95 (patch)
treecccb1fdd583e353f4a229cbb0f9d585104db78f9 /mysql-test/t/ps.test
parenteef51cd83d952b786def92fccde44b41a007c989 (diff)
parent4abe4b1717b099dbf3502e041c246b196622a23f (diff)
downloadmariadb-git-f68085c4e75a2ef4db33a9500b07ad4e37bf8b95.tar.gz
Merge bodhi.local:/opt/local/work/tmp_merge
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-im_options_set.result~59278f56be61d921: Auto merged BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56: Auto merged BitKeeper/deleted/.del-mysys.dsp~32695fee91189326: Auto merged BitKeeper/deleted/.del-im_options_set.imtest~b53d9d60e5684833: Auto merged BitKeeper/deleted/.del-im_options_unset.imtest~768eb186b51d0048: Auto merged BitKeeper/deleted/.del-im_options_unset.result~20a4790cd3c70a4f: Auto merged client/mysql.cc: Auto merged client/mysqlbinlog.cc: Auto merged client/mysqlcheck.c: Auto merged client/mysqldump.c: Auto merged client/mysqltest.c: Auto merged dbug/dbug.c: Auto merged extra/perror.c: Auto merged extra/yassl/src/yassl_imp.cpp: Auto merged extra/yassl/src/yassl_int.cpp: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/cast.result: Auto merged mysql-test/r/date_formats.result: Auto merged mysql-test/r/federated.result: Auto merged mysql-test/r/func_compress.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/gis-rtree.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/im_daemon_life_cycle.result: Auto merged mysql-test/r/im_utils.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/mysqlcheck.result: Auto merged mysql-test/r/rpl_sp.result: Auto merged mysql-test/r/rpl_trigger.result: Auto merged mysql-test/r/sp-code.result: Auto merged mysql-test/r/sp-security.result: Auto merged mysql-test/r/strict.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/r/type_datetime.result: Auto merged mysql-test/r/type_ranges.result: Auto merged mysql-test/r/udf.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/t/cast.test: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/func_group.test: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/im_daemon_life_cycle.imtest: Auto merged mysql-test/t/im_life_cycle.imtest: Auto merged mysql-test/t/im_utils.imtest: Auto merged mysql-test/t/mysql.test: Auto merged mysql-test/t/mysqlbinlog.test: Auto merged mysql-test/t/mysqlcheck.test: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/rpl_trigger.test: Auto merged mysql-test/t/sp-security.test: Auto merged mysql-test/t/strict.test: Auto merged mysql-test/t/udf.test: Auto merged sql/field.cc: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/mysqld.cc: Auto merged sql/protocol.cc: Auto merged sql/slave.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_udf.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.cc: Auto merged sql-common/client.c: Auto merged sql-common/my_time.c: Auto merged sql/table.h: Auto merged storage/ndb/src/kernel/error/ndbd_exit_codes.c: Auto merged storage/ndb/src/mgmsrv/ConfigInfo.cpp: Auto merged mysql-test/r/im_life_cycle.result: e use local mysql-test/r/ps.result: use local client/Makefile.am: Manual merge. client/mysqlimport.c: Manual merge. configure.in: Manual merge. mysql-test/mysql-test-run.pl: Manual merge. mysql-test/r/mysqldump.result: Manual merge. mysql-test/r/mysqltest.result: Manual merge. mysql-test/r/ndb_basic.result: Manual merge. mysql-test/r/rpl_view.result: Manual merge. mysql-test/r/show_check.result: Manual merge. mysql-test/r/sp-error.result: Manual merge. mysql-test/r/sp.result: Manual merge. mysql-test/r/union.result: Manual merge. mysql-test/t/mysqldump.test: Manual merge. mysql-test/t/mysqltest.test: Manual merge. mysql-test/t/ndb_basic.test: Manual merge. mysql-test/t/rpl_sp.test: Manual merge. mysql-test/t/rpl_view.test: Manual merge. mysql-test/t/show_check.test: Manual merge. mysql-test/t/sp-error.test: Manual merge. mysql-test/t/sp.test: Manual merge. sql/item_sum.cc: Manual merge. sql/mysql_priv.h: Manual merge. sql/sp_head.cc: Manual merge. sql/sql_db.cc: Manual merge. sql/sql_delete.cc: Manual merge. sql/sql_lex.h: Manual merge. sql/sql_show.cc: Manual merge. sql/sql_table.cc: Manual merge. sql/sql_trigger.cc: Manual merge. sql/sql_yacc.yy: Manual merge. tests/mysql_client_test.c: Manual merge.
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r--mysql-test/t/ps.test293
1 files changed, 167 insertions, 126 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 9165fceb85e..aa7b6ebf266 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -491,6 +491,7 @@ deallocate prepare stmt;
drop table t1, t2;
#
+#
# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
# tables"
# Check that multi-delete tables are also cleaned up before re-execution.
@@ -538,86 +539,6 @@ SELECT FOUND_ROWS();
deallocate prepare stmt;
#
-# Bug#8115: equality propagation and prepared statements
-#
-
-create table t1 (a char(3) not null, b char(3) not null,
- c char(3) not null, primary key (a, b, c));
-create table t2 like t1;
-
-# reduced query
-prepare stmt from
- "select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
- where t1.a=1";
-execute stmt;
-execute stmt;
-execute stmt;
-
-# original query
-prepare stmt from
-"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
-(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
-left outer join t2 t3 on t3.a=? where t1.a=?";
-
-set @a:=1, @b:=1, @c:=1;
-
-execute stmt using @a, @b, @c;
-execute stmt using @a, @b, @c;
-execute stmt using @a, @b, @c;
-
-deallocate prepare stmt;
-
-drop table t1,t2;
-
-
-#
-# Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement
-#
-
-eval SET @aux= "SELECT COUNT(*)
- FROM INFORMATION_SCHEMA.COLUMNS A,
- INFORMATION_SCHEMA.COLUMNS B
- WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
- AND A.TABLE_NAME = B.TABLE_NAME
- AND A.COLUMN_NAME = B.COLUMN_NAME AND
- A.TABLE_NAME = 'user'";
-
-let $exec_loop_count= 3;
-eval prepare my_stmt from @aux;
-while ($exec_loop_count)
-{
- eval execute my_stmt;
- dec $exec_loop_count;
-}
-deallocate prepare my_stmt;
-
-# Test CALL in prepared mode
-delimiter |;
---disable_warnings
-drop procedure if exists p1|
-drop table if exists t1|
---enable_warnings
-create table t1 (id int)|
-insert into t1 values(1)|
-create procedure p1(a int, b int)
-begin
- declare c int;
- select max(id)+1 into c from t1;
- insert into t1 select a+b;
- insert into t1 select a-b;
- insert into t1 select a-c;
-end|
-set @a= 3, @b= 4|
-prepare stmt from "call p1(?, ?)"|
-execute stmt using @a, @b|
-execute stmt using @a, @b|
-select * from t1|
-deallocate prepare stmt|
-drop procedure p1|
-drop table t1|
-delimiter ;|
-
-#
# Bug#9096 "select doesn't return all matched records if prepared statements
# is used"
# The bug was is bad co-operation of the optimizer's algorithm which determines
@@ -692,35 +613,6 @@ deallocate prepare stmt;
drop table t1, t2;
#
-# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
-# support for placeholders in LIMIT clause."
-# Add basic test coverage for the feature.
-#
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-prepare stmt from "select * from t1 limit ?, ?";
-set @offset=0, @limit=1;
-execute stmt using @offset, @limit;
-select * from t1 limit 0, 1;
-set @offset=3, @limit=2;
-execute stmt using @offset, @limit;
-select * from t1 limit 3, 2;
-prepare stmt from "select * from t1 limit ?";
-execute stmt using @limit;
---error 1235
-prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
-prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
-set @offset=9;
-set @limit=2;
-execute stmt using @offset, @limit;
-prepare stmt from "(select * from t1 limit ?, ?) union all
- (select * from t1 limit ?, ?) order by a limit ?";
-execute stmt using @offset, @limit, @offset, @limit, @limit;
-
-drop table t1;
-deallocate prepare stmt;
-
-#
# Bug#11060 "Server crashes on calling stored procedure with INSERT SELECT
# UNION SELECT" aka "Server crashes on re-execution of prepared INSERT ...
# SELECT with UNION".
@@ -837,22 +729,6 @@ select ??;
select ? from t1;
--enable_ps_protocol
drop table t1;
-
-#
-# Bug#12651
-# (Crash on a PS including a subquery which is a select from a simple view)
-#
-CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
-CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
-CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
-
-PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
-EXECUTE b12651;
-
-DROP VIEW b12651_V1;
-DROP TABLE b12651_T1, b12651_T2;
-DEALLOCATE PREPARE b12651;
-
#
# Bug#9359 "Prepared statements take snapshot of system vars at PREPARE
# time"
@@ -1087,7 +963,172 @@ select @@max_prepared_stmt_count, @@prepared_stmt_count;
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
--enable_ps_protocol
-# End of 4.1 tests
+#
+# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
+# tables"
+# Check that multi-delete tables are also cleaned up before re-execution.
+#
+--disable_warnings
+drop table if exists t1;
+create temporary table if not exists t1 (a1 int);
+--enable_warnings
+# exact delete syntax is essential
+prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+# the server crashed on the next statement without the fix
+execute stmt;
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+# the problem was in memory corruption: repeat the test just in case
+execute stmt;
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+execute stmt;
+drop temporary table t1;
+deallocate prepare stmt;
+
+--echo End of 4.1 tests
+############################# 5.0 tests start ################################
+#
+#
+# Bug#6102 "Server crash with prepared statement and blank after
+# function name"
+# ensure that stored functions are cached when preparing a statement
+# before we open tables
+#
+create table t1 (a varchar(20));
+insert into t1 values ('foo');
+--error 1305
+prepare stmt FROM 'SELECT char_length (a) FROM t1';
+drop table t1;
+
+#
+# Bug#8115: equality propagation and prepared statements
+#
+
+create table t1 (a char(3) not null, b char(3) not null,
+ c char(3) not null, primary key (a, b, c));
+create table t2 like t1;
+
+# reduced query
+prepare stmt from
+ "select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
+ where t1.a=1";
+execute stmt;
+execute stmt;
+execute stmt;
+
+# original query
+prepare stmt from
+"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
+(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
+left outer join t2 t3 on t3.a=? where t1.a=?";
+
+set @a:=1, @b:=1, @c:=1;
+
+execute stmt using @a, @b, @c;
+execute stmt using @a, @b, @c;
+execute stmt using @a, @b, @c;
+
+deallocate prepare stmt;
+
+drop table t1,t2;
+
+
+#
+# Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement
+#
+
+eval SET @aux= "SELECT COUNT(*)
+ FROM INFORMATION_SCHEMA.COLUMNS A,
+ INFORMATION_SCHEMA.COLUMNS B
+ WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
+ AND A.TABLE_NAME = B.TABLE_NAME
+ AND A.COLUMN_NAME = B.COLUMN_NAME AND
+ A.TABLE_NAME = 'user'";
+
+let $exec_loop_count= 3;
+eval prepare my_stmt from @aux;
+while ($exec_loop_count)
+{
+ eval execute my_stmt;
+ dec $exec_loop_count;
+}
+deallocate prepare my_stmt;
+
+# Test CALL in prepared mode
+delimiter |;
+--disable_warnings
+drop procedure if exists p1|
+drop table if exists t1|
+--enable_warnings
+create table t1 (id int)|
+insert into t1 values(1)|
+create procedure p1(a int, b int)
+begin
+ declare c int;
+ select max(id)+1 into c from t1;
+ insert into t1 select a+b;
+ insert into t1 select a-b;
+ insert into t1 select a-c;
+end|
+set @a= 3, @b= 4|
+prepare stmt from "call p1(?, ?)"|
+execute stmt using @a, @b|
+execute stmt using @a, @b|
+select * from t1|
+deallocate prepare stmt|
+drop procedure p1|
+drop table t1|
+delimiter ;|
+
+
+#
+# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
+# support for placeholders in LIMIT clause."
+# Add basic test coverage for the feature.
+#
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+prepare stmt from "select * from t1 limit ?, ?";
+set @offset=0, @limit=1;
+execute stmt using @offset, @limit;
+select * from t1 limit 0, 1;
+set @offset=3, @limit=2;
+execute stmt using @offset, @limit;
+select * from t1 limit 3, 2;
+prepare stmt from "select * from t1 limit ?";
+execute stmt using @limit;
+--error 1235
+prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
+prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
+set @offset=9;
+set @limit=2;
+execute stmt using @offset, @limit;
+prepare stmt from "(select * from t1 limit ?, ?) union all
+ (select * from t1 limit ?, ?) order by a limit ?";
+execute stmt using @offset, @limit, @offset, @limit, @limit;
+
+drop table t1;
+deallocate prepare stmt;
+
+#
+# Bug#12651
+# (Crash on a PS including a subquery which is a select from a simple view)
+#
+CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
+CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
+CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
+
+PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
+EXECUTE b12651;
+
+DROP VIEW b12651_V1;
+DROP TABLE b12651_T1, b12651_T2;
+DEALLOCATE PREPARE b12651;
+
+
#
# Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared