Commit 783cae18 authored by Patrick Crews's avatar Patrick Crews

merge 5.0 -> 5.1

These are only 5.0's fixes being merged.
5.1 and 6.0 Unix-removals will occur in different patches.
parents 40619ea3 ac46e344
......@@ -2,6 +2,13 @@
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to
# 'grep' call
# This test is disabled on Windows via the next line until the above bug is
# resolved
--source include/not_windows.inc
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
# there is no neat way to find the backupid, this is a hack to find it...
......
......@@ -395,7 +395,14 @@ flush logs;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
We expect this value to be 1
The bug being tested was that 'Query' lines were not preceded by '#'
If the line is in the table, it had to have been preceded by a '#'
SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
BUG#28293_expect_1
1
DROP TABLE patch;
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
......
......@@ -215,7 +215,6 @@ source database
"MySQL: The world's most popular ;open source database"
echo message echo message
mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec
MySQL
"MySQL"
......@@ -383,7 +382,6 @@ mysqltest: At line 1: The argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: system command 'false' failed
system command 'NonExistsinfComamdn 2> /dev/null' failed
test
test2
......
......@@ -12,9 +12,7 @@ GRANT CREATE, TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost;
---> connection: wl2818_definer_con
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
---> patching t1.TRG...
......
-- source include/have_ndb.inc
-- source include/not_embedded.inc
# Bug#41308: Test main.ndb_autodiscover.test doesn't work on Windows due
# to 'grep' calls
# Test is currently disabled on Windows via the next line until this bug
# can be resolved.
--source include/not_windows.inc
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--enable_warnings
......
......@@ -180,7 +180,7 @@ delimiter ;//
flush logs;
call p1();
drop procedure p1;
--error 1305
--error ER_SP_DOES_NOT_EXIST
call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
......@@ -232,7 +232,26 @@ flush logs;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
# We create a table, patch, and load the output into it
# By using LINES STARTING BY '#' + SELECT WHERE a LIKE 'Query'
# We can easily see if a 'Query' line is missing the '#' character
# as described in the original bug
--disable_query_log
CREATE TABLE patch (a blob);
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
INTO TABLE patch FIELDS TERMINATED by '' LINES STARTING BY '#';
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log
--echo We expect this value to be 1
--echo The bug being tested was that 'Query' lines were not preceded by '#'
--echo If the line is in the table, it had to have been preceded by a '#'
--echo
SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP TABLE patch;
#
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
......
......@@ -62,7 +62,8 @@ select otto from (select 1 as otto) as t1;
--exec echo "select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
# expectation = response
--error 1054
--error ER_BAD_FIELD_ERROR
select friedrich from (select 1 as otto) as t1;
# The following unmasked unsuccessful statement must give
......@@ -135,14 +136,16 @@ eval select $mysql_errno as "after_successful_stmt_errno" ;
#----------------------------------------------------------------------------
# check mysql_errno = 1064 after statement with wrong syntax
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
eval select $mysql_errno as "after_wrong_syntax_errno" ;
# ----------------------------------------------------------------------------
# check if let $my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
let $my_var= 'abc' ;
eval select $mysql_errno as "after_let_var_equal_value" ;
......@@ -150,7 +153,8 @@ eval select $mysql_errno as "after_let_var_equal_value" ;
# ----------------------------------------------------------------------------
# check if set @my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
set @my_var= 'abc' ;
eval select $mysql_errno as "after_set_var_equal_value" ;
......@@ -159,7 +163,8 @@ eval select $mysql_errno as "after_set_var_equal_value" ;
# check if the setting of --disable-warnings itself affects $mysql_errno
# (May be --<whatever> modifies $mysql_errno.)
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--disable_warnings
eval select $mysql_errno as "after_disable_warnings_command" ;
......@@ -170,7 +175,8 @@ eval select $mysql_errno as "after_disable_warnings_command" ;
# (May be disabled warnings affect $mysql_errno.)
# ----------------------------------------------------------------------------
drop table if exists t1 ;
--error 1064
--error ER_PARSE_ERROR
garbage ;
drop table if exists t1 ;
eval select $mysql_errno as "after_disable_warnings" ;
......@@ -179,21 +185,26 @@ eval select $mysql_errno as "after_disable_warnings" ;
# ----------------------------------------------------------------------------
# check if masked errors affect $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_minus_masked" ;
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_!_masked" ;
# ----------------------------------------------------------------------------
# Will manipulations of $mysql_errno be possible and visible ?
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
let $mysql_errno= -1;
eval select $mysql_errno as "after_let_errno_equal_value" ;
......@@ -202,50 +213,61 @@ eval select $mysql_errno as "after_let_errno_equal_value" ;
# How affect actions on prepared statements $mysql_errno ?
# ----------------------------------------------------------------------------
# failing prepare
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_failing_prepare" ;
create table t1 ( f1 char(10));
# successful prepare
--error 1064
--error ER_PARSE_ERROR
garbage ;
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_successful_prepare" ;
# successful execute
--error 1064
--error ER_PARSE_ERROR
garbage ;
execute stmt;
eval select $mysql_errno as "after_successful_execute" ;
# failing execute (table has been dropped)
drop table t1;
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
execute stmt;
eval select $mysql_errno as "after_failing_execute" ;
# failing execute (unknown statement)
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1243
--error ER_UNKNOWN_STMT_HANDLER
execute __stmt_;
eval select $mysql_errno as "after_failing_execute" ;
# successful deallocate
--error 1064
--error ER_PARSE_ERROR
garbage ;
deallocate prepare stmt;
eval select $mysql_errno as "after_successful_deallocate" ;
# failing deallocate ( statement handle does not exist )
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1243
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare __stmt_;
eval select $mysql_errno as "after_failing_deallocate" ;
......@@ -270,7 +292,8 @@ eval select $mysql_errno as "after_failing_deallocate" ;
# ----------------------------------------------------------------------------
# Switch off the abort on error and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--disable_abort_on_error
eval select $mysql_errno as "after_--disable_abort_on_error" ;
......@@ -284,9 +307,11 @@ select 3 from t1 ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_!errno_masked_error" ;
# expected error <> response
......@@ -300,7 +325,8 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
# ----------------------------------------------------------------------------
# Switch the abort on error on and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--enable_abort_on_error
eval select $mysql_errno as "after_--enable_abort_on_error" ;
......@@ -309,7 +335,8 @@ eval select $mysql_errno as "after_--enable_abort_on_error" ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
# ----------------------------------------------------------------------------
......@@ -572,9 +599,6 @@ echo ;
# ----------------------------------------------------------------------------
# Illegal use of exec
--error 1
--exec echo "--exec false" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
......@@ -955,8 +979,6 @@ system echo "hej" > /dev/null;
--exec echo "system;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
system NonExistsinfComamdn 2> /dev/null;
......@@ -1374,7 +1396,8 @@ connection default;
let $num= 2;
while ($num)
{
--error 1064
--error ER_PARSE_ERROR
failing_statement;
dec $num;
......@@ -1433,7 +1456,7 @@ select "this will be executed";
#
# Test zero length result file. Should not pass
#
--exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo '' > $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result > /dev/null 2>&1
......@@ -1486,7 +1509,8 @@ drop table t1;
--error 1
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should be non existent
--exec test ! -s $MYSQLTEST_VARDIR/tmp/bug11731.out
--error 1
--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
......@@ -1508,7 +1532,7 @@ drop table t1;
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should exist
--exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
......@@ -1520,14 +1544,17 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
# It should be possible to use the command "query" to force mysqltest to
# send the command to the server although it's a builtin mysqltest command.
--error 1064
--error ER_PARSE_ERROR
query sleep;
--error 1064
--error ER_PARSE_ERROR
--query sleep
# Just an empty query command
--error 1065
--error ER_EMPTY_QUERY
query ;
# test for replace_regex
......@@ -1921,7 +1948,8 @@ eval $my_stmt;
# 8. Ensure that "sorted_result " does not change the semantics of
# "--error ...." or the protocol output after such an expected failure
--sorted_result
--error 1146
--error ER_NO_SUCH_TABLE
SELECT '2' as "my_col1",2 as "my_col2"
UNION
SELECT '1',1 from t2;
......
......@@ -49,9 +49,7 @@ GRANT CREATE, TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost;
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
#
# Remove definers from TRG file.
......@@ -60,9 +58,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--echo
--echo ---> patching t1.TRG...
let $MYSQLD_DATADIR= `select @@datadir`;
--exec grep -v 'definers=' $MYSQLD_DATADIR/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
--exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLD_DATADIR/mysqltest_db1/t1.TRG
# Here we remove definers. This is somewhat complex than the original test
# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not
# portable and we have to load the file into a table, exclude the definers line,
# then load the data to an outfile to accomplish the same effect
--disable_query_log
--connection default
CREATE TABLE patch (a blob);
let $MYSQLD_DATADIR = `select @@datadir`;
eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' INTO TABLE patch;
# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
--remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.TRG
eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
'$MYSQLD_DATADIR/mysqltest_db1/t1.TRG'
FROM patch;
DROP TABLE patch;
--connection wl2818_definer_con
--enable_query_log
#
# Create a new trigger.
......
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