Commit ac808129 authored by Bernt M. Johnsen's avatar Bernt M. Johnsen

Bug 43355 merged from 5.1 gca

parents 02884a4d c517fc2b
...@@ -418,17 +418,17 @@ prepare stmt3 from ' lock tables t1 read ' ; ...@@ -418,17 +418,17 @@ prepare stmt3 from ' lock tables t1 read ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' unlock tables ' ; prepare stmt3 from ' unlock tables ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' load data infile ''data.txt'' prepare stmt1 from ' load data infile ''<MYSQLTEST_VARDIR>/tmp/data.txt''
into table t1 fields terminated by ''\t'' '; into table t1 fields terminated by ''\t'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 '; prepare stmt1 from ' select * into outfile ''<MYSQLTEST_VARDIR>/tmp/data.txt'' from t1 ';
execute stmt1 ; execute stmt1 ;
prepare stmt1 from ' optimize table t1 ' ; prepare stmt1 from ' optimize table t1 ' ;
prepare stmt1 from ' analyze table t1 ' ; prepare stmt1 from ' analyze table t1 ' ;
prepare stmt1 from ' checksum table t1 ' ; prepare stmt1 from ' checksum table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' repair table t1 ' ; prepare stmt1 from ' repair table t1 ' ;
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ; prepare stmt1 from ' restore table t1 from ''<MYSQLTEST_VARDIR>/tmp/data.txt'' ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' handler t1 open '; prepare stmt1 from ' handler t1 open ';
ERROR HY000: This command is not supported in the prepared statement protocol yet ERROR HY000: This command is not supported in the prepared statement protocol yet
......
...@@ -4390,9 +4390,9 @@ drop procedure if exists bug13012| ...@@ -4390,9 +4390,9 @@ drop procedure if exists bug13012|
create procedure bug13012() create procedure bug13012()
BEGIN BEGIN
REPAIR TABLE t1; REPAIR TABLE t1;
BACKUP TABLE t1 to '../tmp'; BACKUP TABLE t1 to '<MYSQLTEST_VARDIR>/tmp/';
DROP TABLE t1; DROP TABLE t1;
RESTORE TABLE t1 FROM '../tmp'; RESTORE TABLE t1 FROM '<MYSQLTEST_VARDIR>/tmp/';
END| END|
call bug13012()| call bug13012()|
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
......
...@@ -70,71 +70,71 @@ prepare stmt1 from ' select 1 as my_col ' ; ...@@ -70,71 +70,71 @@ prepare stmt1 from ' select 1 as my_col ' ;
# prepare with parameter # prepare with parameter
prepare stmt1 from ' select ? as my_col ' ; prepare stmt1 from ' select ? as my_col ' ;
# prepare must fail (incomplete statements/wrong syntax) # prepare must fail (incomplete statements/wrong syntax)
--error 1064 --error ER_PARSE_ERROR
prepare ; prepare ;
--error 1064 --error ER_PARSE_ERROR
prepare stmt1 ; prepare stmt1 ;
--error 1064 --error ER_PARSE_ERROR
prepare stmt1 from ; prepare stmt1 from ;
--error 1064 --error ER_PARSE_ERROR
prepare_garbage stmt1 from ' select 1 ' ; prepare_garbage stmt1 from ' select 1 ' ;
--error 1064 --error ER_PARSE_ERROR
prepare stmt1 from_garbage ' select 1 ' ; prepare stmt1 from_garbage ' select 1 ' ;
--error 1064 --error ER_PARSE_ERROR
prepare stmt1 from ' select_garbage 1 ' ; prepare stmt1 from ' select_garbage 1 ' ;
--error 1064 --error ER_PARSE_ERROR
prepare from ' select 1 ' ; prepare from ' select 1 ' ;
--error 1064 --error ER_PARSE_ERROR
prepare stmt1 ' select 1 ' ; prepare stmt1 ' select 1 ' ;
--error 1064 --error ER_PARSE_ERROR
prepare ? from ' select ? as my_col ' ; prepare ? from ' select ? as my_col ' ;
# statement in variable # statement in variable
set @arg00='select 1 as my_col'; set @arg00='select 1 as my_col';
prepare stmt1 from @arg00; prepare stmt1 from @arg00;
# prepare must fail (query variable is empty) # prepare must fail (query variable is empty)
set @arg00=''; set @arg00='';
--error 1065 --error ER_EMPTY_QUERY
prepare stmt1 from @arg00; prepare stmt1 from @arg00;
set @arg00=NULL; set @arg00=NULL;
# prepare must fail (query variable is NULL) # prepare must fail (query variable is NULL)
--error 1064 --error ER_PARSE_ERROR
prepare stmt1 from @arg01; prepare stmt1 from @arg01;
prepare stmt1 from ' select * from t1 where a <= 2 ' ; prepare stmt1 from ' select * from t1 where a <= 2 ' ;
# prepare must fail (column x does not exist) # prepare must fail (column x does not exist)
--error 1054 --error ER_BAD_FIELD_ERROR
prepare stmt1 from ' select * from t1 where x <= 2 ' ; prepare stmt1 from ' select * from t1 where x <= 2 ' ;
# cases derived from client_test.c: test_null() # cases derived from client_test.c: test_null()
# prepare must fail (column x does not exist) # prepare must fail (column x does not exist)
--error 1054 --error ER_BAD_FIELD_ERROR
prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ; prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
--error 1054 --error ER_BAD_FIELD_ERROR
prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ; prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
--disable_warnings --disable_warnings
drop table if exists not_exist ; drop table if exists not_exist ;
--enable_warnings --enable_warnings
# prepare must fail (table does not exist) # prepare must fail (table does not exist)
--error 1146 --error ER_NO_SUCH_TABLE
prepare stmt1 from ' select * from not_exist where a <= 2 ' ; prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
# case derived from client_test.c: test_prepare_syntax() # case derived from client_test.c: test_prepare_syntax()
# prepare must fail (incomplete statement) # prepare must fail (incomplete statement)
--error 1064 --error ER_PARSE_ERROR
prepare stmt1 from ' insert into t1 values(? ' ; prepare stmt1 from ' insert into t1 values(? ' ;
--error 1064 --error ER_PARSE_ERROR
prepare stmt1 from ' select a, b from t1 prepare stmt1 from ' select a, b from t1
where a=? and where ' ; where a=? and where ' ;
################ EXECUTE ################ ################ EXECUTE ################
# execute must fail (statement never_prepared never prepared) # execute must fail (statement never_prepared never prepared)
--error 1243 --error ER_UNKNOWN_STMT_HANDLER
execute never_prepared ; execute never_prepared ;
# execute must fail (prepare stmt1 just failed, # execute must fail (prepare stmt1 just failed,
# but there was a successful prepare of stmt1 before) # but there was a successful prepare of stmt1 before)
prepare stmt1 from ' select * from t1 where a <= 2 ' ; prepare stmt1 from ' select * from t1 where a <= 2 ' ;
--error 1146 --error ER_NO_SUCH_TABLE
prepare stmt1 from ' select * from not_exist where a <= 2 ' ; prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
--error 1243 --error ER_UNKNOWN_STMT_HANDLER
execute stmt1 ; execute stmt1 ;
# drop the table between prepare and execute # drop the table between prepare and execute
...@@ -149,7 +149,7 @@ prepare stmt2 from ' select * from t5 ' ; ...@@ -149,7 +149,7 @@ prepare stmt2 from ' select * from t5 ' ;
execute stmt2 ; execute stmt2 ;
drop table t5 ; drop table t5 ;
# execute must fail (table was dropped after prepare) # execute must fail (table was dropped after prepare)
--error 1146 --error ER_NO_SUCH_TABLE
execute stmt2 ; execute stmt2 ;
# cases derived from client_test.c: test_select_prepare() # cases derived from client_test.c: test_select_prepare()
# 1. drop + create table (same column names/types/order) # 1. drop + create table (same column names/types/order)
...@@ -218,7 +218,7 @@ create table t5 ...@@ -218,7 +218,7 @@ create table t5
f3 int f3 int
); );
insert into t5( f1, f2, f3) values( 9, 'recreated table', 9); insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
--error 1054 --error ER_BAD_FIELD_ERROR
execute stmt2 ; execute stmt2 ;
drop table t5 ; drop table t5 ;
...@@ -231,24 +231,24 @@ set @arg01='two' ; ...@@ -231,24 +231,24 @@ set @arg01='two' ;
prepare stmt1 from ' select * from t1 where a <= ? ' ; prepare stmt1 from ' select * from t1 where a <= ? ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
# execute must fail (too small number of parameters) # execute must fail (too small number of parameters)
--error 1210 --error ER_WRONG_ARGUMENTS
execute stmt1 ; execute stmt1 ;
# execute must fail (too big number of parameters) # execute must fail (too big number of parameters)
--error 1210 --error ER_WRONG_ARGUMENTS
execute stmt1 using @arg00, @arg01; execute stmt1 using @arg00, @arg01;
# execute must fail (parameter is not set) # execute must fail (parameter is not set)
execute stmt1 using @not_set; execute stmt1 using @not_set;
################ DEALLOCATE ################ ################ DEALLOCATE ################
# deallocate must fail (the statement 'never_prepared' was never prepared) # deallocate must fail (the statement 'never_prepared' was never prepared)
--error 1243 --error ER_UNKNOWN_STMT_HANDLER
deallocate prepare never_prepared ; deallocate prepare never_prepared ;
# deallocate must fail (prepare stmt1 just failed, # deallocate must fail (prepare stmt1 just failed,
# but there was a successful prepare before) # but there was a successful prepare before)
prepare stmt1 from ' select * from t1 where a <= 2 ' ; prepare stmt1 from ' select * from t1 where a <= 2 ' ;
--error 1146 --error ER_NO_SUCH_TABLE
prepare stmt1 from ' select * from not_exist where a <= 2 ' ; prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
--error 1243 --error ER_UNKNOWN_STMT_HANDLER
deallocate prepare stmt1; deallocate prepare stmt1;
create table t5 create table t5
( (
...@@ -330,17 +330,17 @@ prepare stmt4 from ' show engine bdb logs '; ...@@ -330,17 +330,17 @@ prepare stmt4 from ' show engine bdb logs ';
execute stmt4; execute stmt4;
--enable_result_log --enable_result_log
prepare stmt4 from ' show grants for user '; prepare stmt4 from ' show grants for user ';
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt4 from ' show create table t2 '; prepare stmt4 from ' show create table t2 ';
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt4 from ' show master status '; prepare stmt4 from ' show master status ';
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt4 from ' show master logs '; prepare stmt4 from ' show master logs ';
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt4 from ' show slave status '; prepare stmt4 from ' show slave status ';
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt4 from ' show warnings limit 20 '; prepare stmt4 from ' show warnings limit 20 ';
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt4 from ' show errors limit 20 '; prepare stmt4 from ' show errors limit 20 ';
prepare stmt4 from ' show storage engines '; prepare stmt4 from ' show storage engines ';
--replace_column 2 YES/NO --replace_column 2 YES/NO
...@@ -355,7 +355,7 @@ drop table if exists t5; ...@@ -355,7 +355,7 @@ drop table if exists t5;
prepare stmt1 from ' drop table if exists t5 ' ; prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ; execute stmt1 ;
prepare stmt1 from ' drop table t5 ' ; prepare stmt1 from ' drop table t5 ' ;
--error 1051 --error ER_BAD_TABLE_ERROR
execute stmt1 ; execute stmt1 ;
## SELECT @@version ## SELECT @@version
...@@ -428,14 +428,14 @@ prepare stmt1 from ' deallocate prepare never_prepared ' ; ...@@ -428,14 +428,14 @@ prepare stmt1 from ' deallocate prepare never_prepared ' ;
prepare stmt1 from 'alter view v1 as select 2'; prepare stmt1 from 'alter view v1 as select 2';
## switch the database connection ## switch the database connection
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt4 from ' use test ' ; prepare stmt4 from ' use test ' ;
## create/drop database ## create/drop database
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt3 from ' create database mysqltest '; prepare stmt3 from ' create database mysqltest ';
create database mysqltest ; create database mysqltest ;
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt3 from ' drop database mysqltest '; prepare stmt3 from ' drop database mysqltest ';
drop database mysqltest ; drop database mysqltest ;
...@@ -444,29 +444,40 @@ drop database mysqltest ; ...@@ -444,29 +444,40 @@ drop database mysqltest ;
prepare stmt3 from ' describe t2 '; prepare stmt3 from ' describe t2 ';
execute stmt3; execute stmt3;
drop table t2 ; drop table t2 ;
--error 1146 --error ER_NO_SUCH_TABLE
execute stmt3; execute stmt3;
## lock/unlock ## lock/unlock
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt3 from ' lock tables t1 read ' ; prepare stmt3 from ' lock tables t1 read ' ;
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt3 from ' unlock tables ' ; prepare stmt3 from ' unlock tables ' ;
## Load/Unload table contents ## Load/Unload table contents
--error 1295
prepare stmt1 from ' load data infile ''data.txt'' --let $datafile = $MYSQLTEST_VARDIR/tmp/data.txt
into table t1 fields terminated by ''\t'' '; --error 0,1
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 '; --remove_file $datafile
execute stmt1 ;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--error ER_UNSUPPORTED_PS
eval prepare stmt1 from ' load data infile ''$datafile''
into table t1 fields terminated by ''\t'' ';
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval prepare stmt1 from ' select * into outfile ''$datafile'' from t1 ';
execute stmt1 ;
## ##
prepare stmt1 from ' optimize table t1 ' ; prepare stmt1 from ' optimize table t1 ' ;
prepare stmt1 from ' analyze table t1 ' ; prepare stmt1 from ' analyze table t1 ' ;
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt1 from ' checksum table t1 ' ; prepare stmt1 from ' checksum table t1 ' ;
prepare stmt1 from ' repair table t1 ' ; prepare stmt1 from ' repair table t1 ' ;
--error 1295 --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ; --error ER_UNSUPPORTED_PS
eval prepare stmt1 from ' restore table t1 from ''$datafile'' ' ;
--remove_file $datafile
## handler ## handler
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt1 from ' handler t1 open '; prepare stmt1 from ' handler t1 open ';
...@@ -492,11 +503,11 @@ SET sql_mode=ansi; ...@@ -492,11 +503,11 @@ SET sql_mode=ansi;
execute stmt5; execute stmt5;
SET sql_mode=""; SET sql_mode="";
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt1 from ' flush local privileges ' ; prepare stmt1 from ' flush local privileges ' ;
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt1 from ' reset query cache ' ; prepare stmt1 from ' reset query cache ' ;
--error 1295 --error ER_UNSUPPORTED_PS
prepare stmt1 from ' KILL 0 '; prepare stmt1 from ' KILL 0 ';
## simple explain ## simple explain
...@@ -582,7 +593,7 @@ drop table if exists new_t2; ...@@ -582,7 +593,7 @@ drop table if exists new_t2;
--enable_warnings --enable_warnings
prepare stmt3 from ' rename table t2 to new_t2 '; prepare stmt3 from ' rename table t2 to new_t2 ';
execute stmt3; execute stmt3;
--error 1050 --error ER_TABLE_EXISTS_ERROR
execute stmt3; execute stmt3;
rename table new_t2 to t2; rename table new_t2 to t2;
drop table t2; drop table t2;
...@@ -593,13 +604,13 @@ create table t5 (a int) ; ...@@ -593,13 +604,13 @@ create table t5 (a int) ;
# rename must fail, t7 does not exist # rename must fail, t7 does not exist
# Clean up the filename here because embedded server reports whole path # Clean up the filename here because embedded server reports whole path
--replace_result \\ / $MYSQLTEST_VARDIR . /master-data/ / t7.frm t7 --replace_result \\ / $MYSQLTEST_VARDIR . /master-data/ / t7.frm t7
--error 1017 --error ER_FILE_NOT_FOUND
execute stmt1 ; execute stmt1 ;
create table t7 (a int) ; create table t7 (a int) ;
# rename, t5 -> t6 and t7 -> t8 # rename, t5 -> t6 and t7 -> t8
execute stmt1 ; execute stmt1 ;
# rename must fail, t5 and t7 does not exist t6 and t8 already exist # rename must fail, t5 and t7 does not exist t6 and t8 already exist
--error 1050 --error ER_TABLE_EXISTS_ERROR
execute stmt1 ; execute stmt1 ;
rename table t6 to t5, t8 to t7 ; rename table t6 to t5, t8 to t7 ;
# rename, t5 -> t6 and t7 -> t8 # rename, t5 -> t6 and t7 -> t8
......
...@@ -1271,7 +1271,7 @@ select *, f8() from v1| ...@@ -1271,7 +1271,7 @@ select *, f8() from v1|
# Let us test what will happen if function is missing # Let us test what will happen if function is missing
drop function f1| drop function f1|
--error 1356 --error ER_VIEW_INVALID
select * from v1| select * from v1|
# And what will happen if we have recursion which involves # And what will happen if we have recursion which involves
...@@ -1310,9 +1310,9 @@ select f0()| ...@@ -1310,9 +1310,9 @@ select f0()|
select * from v0| select * from v0|
select *, f0() from v0, (select 123) as d1| select *, f0() from v0, (select 123) as d1|
# But these should not ! # But these should not !
--error 1100 --error ER_TABLE_NOT_LOCKED
select id, f3() from t1| select id, f3() from t1|
--error 1100 --error ER_TABLE_NOT_LOCKED
select f4()| select f4()|
unlock tables| unlock tables|
...@@ -1322,9 +1322,9 @@ lock tables v2 read, mysql.proc read| ...@@ -1322,9 +1322,9 @@ lock tables v2 read, mysql.proc read|
select * from v2| select * from v2|
select * from v1| select * from v1|
# These should not work as we have too little instances of tables locked # These should not work as we have too little instances of tables locked
--error 1100 --error ER_TABLE_NOT_LOCKED
select * from v1, t1| select * from v1, t1|
--error 1100 --error ER_TABLE_NOT_LOCKED
select f4()| select f4()|
unlock tables| unlock tables|
...@@ -4501,14 +4501,14 @@ begin ...@@ -4501,14 +4501,14 @@ begin
select bug12379(); select bug12379();
end| end|
--error 1062 --error ER_DUP_ENTRY
select bug12379()| select bug12379()|
select 1| select 1|
call bug12379_1()| call bug12379_1()|
select 2| select 2|
call bug12379_2()| call bug12379_2()|
select 3| select 3|
--error 1062 --error ER_DUP_ENTRY
call bug12379_3()| call bug12379_3()|
select 4| select 4|
...@@ -5235,18 +5235,29 @@ drop procedure bug5967| ...@@ -5235,18 +5235,29 @@ drop procedure bug5967|
# #
# Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server" # Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server"
# #
--let $backupdir = $MYSQLTEST_VARDIR/tmp/
--error 0,1
--remove_file $backupdir/t1.frm
--error 0,1
--remove_file $backupdir/t1.MYD
--disable_warnings --disable_warnings
drop procedure if exists bug13012| drop procedure if exists bug13012|
--enable_warnings --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
create procedure bug13012() --enable_warnings
BEGIN eval create procedure bug13012()
REPAIR TABLE t1; BEGIN
BACKUP TABLE t1 to '../tmp'; REPAIR TABLE t1;
DROP TABLE t1; BACKUP TABLE t1 to '$backupdir';
RESTORE TABLE t1 FROM '../tmp'; DROP TABLE t1;
END| RESTORE TABLE t1 FROM '$backupdir';
END|
call bug13012()| call bug13012()|
--remove_file $backupdir/t1.frm
--remove_file $backupdir/t1.MYD
drop procedure bug13012| drop procedure bug13012|
create view v1 as select * from t1| create view v1 as select * from t1|
create procedure bug13012() create procedure bug13012()
BEGIN BEGIN
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment