Commit 446fd504 authored by Patrick Crews's avatar Patrick Crews

Merge 5.0 -> 5.1

parents 0d243986 8c33da07
......@@ -20,7 +20,7 @@
eval create table t1 (a int) engine=$engine_type;
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
drop table if exists t1;
save_master_pos;
connection slave;
......
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat
--exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat
--exec rm -f $MYSQLTEST_VARDIR/tmp/tmp.dat
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/tmp.dat
--let ndb_restore_opts=
--let ndb_restore_filter=
......@@ -608,6 +608,65 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
a a
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
INSERT INTO t1 VALUES (1,1,'ORANGE');
INSERT INTO t1 VALUES (2,2,'APPLE');
INSERT INTO t1 VALUES (3,2,'APPLE');
INSERT INTO t1 VALUES (4,3,'PEAR');
SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v1, @v2;
@v1 @v2
2 APPLE
SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
fruit_name HAVING fruit_name = 'APPLE';
SELECT @v3, @v4;
@v3 @v4
2 APPLE
SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8;
@v5 @v6 @v7 @v8
3 PEAR 3 PEAR
SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
WHERE fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8, @v9, @v10;
@v5 @v6 @v7 @v8 @v9 @v10
3 PEAR 3 PEAR 5 PEARAPPLE
SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v11, @v12, @v13, @v14;
@v11 @v12 @v13 @v14
6 PEARPEAR 6 PEARPEAR
SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v15, @v16;
@v15 @v16
6 PEARPEAR
SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v17, @v18;
@v17 @v18
4 Bob
DROP TABLE IF EXISTS t2;
CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
SELECT @v19, @v20;
@v19 @v20
2 APPLE
SELECT * FROM t2;
fruit_id fruit_name
2 APPLE
2 APPLE
DROP TABLE t1;
DROP TABLE t2;
CREATE TABLE t1 (a CHAR(1));
INSERT INTO t1 VALUES('A'), (0);
SELECT a FROM t1 WHERE a=0;
......
......@@ -33,7 +33,7 @@ let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`;
eval select $error_code /* must return 1 as query completed before got killed*/;
# cleanup for the sub-case
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
#
......@@ -61,7 +61,7 @@ let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
eval select $error_code /* must return 0 to mean the killed query is in */;
# cleanup for the sub-case
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
drop table t1,t2;
......
......@@ -21,4 +21,4 @@ select * from t2;
# clean up
drop table t1,t2;
#--system rm $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
#--remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
......@@ -134,10 +134,14 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
--let ndb_restore_filter=test t1
--source include/ndb_backup_print.inc
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt
--let ndb_restore_opts=--verbose=0 --print_data --hex --tab $MYSQLTEST_VARDIR/tmp --append
--let ndb_restore_filter=test
......@@ -156,10 +160,10 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
--source include/show_msg.inc
--exec sort $MYSQLTEST_VARDIR/tmp/t4.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt
# now test some other datatypes
drop table t1;
......
......@@ -113,7 +113,7 @@ flush tables;
# Remove the frm file from disk
--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
--error 1050
--error ER_TABLE_EXISTS_ERROR
create table t3(
id int not null primary key,
name char(20), a int, b float, c char(24)
......@@ -204,13 +204,13 @@ system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS
#
# Test that correct error is returned
--error 1146
--error ER_NO_SUCH_TABLE
select * from t4;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t4;
show status like 'handler_discover%';
--error 1051
--error ER_BAD_TABLE_ERROR
drop table t4;
create table t4(
......@@ -223,14 +223,14 @@ select * from t4;
# Remove the table from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t4;
drop table if exists t4;
# Test that dropping a table that does not exists
# on disk or in NDB gives same result as above
--error 1051
--error ER_BAD_TABLE_ERROR
drop table t5;
drop table if exists t5;
......@@ -257,7 +257,7 @@ system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS
SHOW TABLES;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t4;
#######################################################
......@@ -342,9 +342,9 @@ show status like 'handler_discover%';
# Check that t3 or t5 can't be created
# frm files for these tables is stilll on disk
--error 1050
--error ER_TABLE_EXISTS_ERROR
create table t3(a int);
--error 1050
--error ER_TABLE_EXISTS_ERROR
create table t5(a int);
SHOW TABLES LIKE 't%';
......@@ -462,7 +462,7 @@ show tables;
create database test2;
use test2;
show tables;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t1;
create table t2 (b int,c longblob) engine=ndb;
use test;
......@@ -487,7 +487,7 @@ create table t1 (a int primary key) engine=ndb;
select * from t1;
--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null
--error 1015
--error ER_CANT_LOCK
select * from t1;
--exec $NDB_MGM --no-defaults -e "all start" > /dev/null
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null
......@@ -503,17 +503,17 @@ drop database test_only_ndb_tables;
# discovered( for example a table created via NDBAPI)
# Test disabled since it doesn't work on case insensitive systems
#--error 1050
#--error ER_TABLE_EXISTS_ERROR
#CREATE TABLE sys.SYSTAB_0 (a int);
#--error 1105
#--error ER_UNKNOWN_ERROR
#select * from sys.SYSTAB_0;
#CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int);
#show warnings;
#--error 1105
#--error ER_UNKNOWN_ERROR
#select * from sys.SYSTAB_0;
#--error 1051
#--error ER_BAD_TABLE_ERROR
#drop table sys.SYSTAB_0;
#drop table IF EXISTS sys.SYSTAB_0;
......
......@@ -79,7 +79,8 @@ delete from t1;
--eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt'));
load data infile 't1.txt' into table t1;
select hex(a) from t1;
--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.txt
drop table t1;
--echo End of 5.0 tests
......@@ -438,72 +438,70 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
DROP TABLE t1;
# The test case for bug#20836 should be re-enabled when bug#16861 is resolved
# The results for the test should be the same as in 4.1.
#
#Bug #20836: Selecting into variables results in wrong results being returned
#
#--disable_warnings
#DROP TABLE IF EXISTS t1;
#--enable_warnings
#
#CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
#default NULL);
#
#INSERT INTO t1 VALUES (1,1,'ORANGE');
#INSERT INTO t1 VALUES (2,2,'APPLE');
#INSERT INTO t1 VALUES (3,2,'APPLE');
#INSERT INTO t1 VALUES (4,3,'PEAR');
#
#SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
#'APPLE';
#SELECT @v1, @v2;
#
#SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
#fruit_name HAVING fruit_name = 'APPLE';
#SELECT @v3, @v4;
#
#SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
#fruit_name = 'APPLE';
#SELECT @v5, @v6, @v7, @v8;
#
#SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
#WHERE fruit_name = 'APPLE';
#SELECT @v5, @v6, @v7, @v8, @v9, @v10;
#
#SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
#@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
#SELECT @v11, @v12, @v13, @v14;
#
#SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
#SELECT @v15, @v16;
#
#SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
#'APPLE';
#SELECT @v17, @v18;
#
#--disable_warnings
#DROP TABLE IF EXISTS t2;
#--enable_warnings
#
#CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
#default NULL);
#
#SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
#'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
#LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
#--exec rm $MYSQL_TEST_DIR/var/tmp/data1.tmp
#
#SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
#'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
#LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
#--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp
#
#SELECT @v19, @v20;
#SELECT * FROM t2;
#
#DROP TABLE t1;
#DROP TABLE t2;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
INSERT INTO t1 VALUES (1,1,'ORANGE');
INSERT INTO t1 VALUES (2,2,'APPLE');
INSERT INTO t1 VALUES (3,2,'APPLE');
INSERT INTO t1 VALUES (4,3,'PEAR');
SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v1, @v2;
SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
fruit_name HAVING fruit_name = 'APPLE';
SELECT @v3, @v4;
SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8;
SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
WHERE fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8, @v9, @v10;
SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v11, @v12, @v13, @v14;
SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v15, @v16;
SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v17, @v18;
--disable_warnings
DROP TABLE IF EXISTS t2;
--enable_warnings
CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
--remove_file $MYSQL_TEST_DIR/var/tmp/data1.tmp
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
--remove_file $MYSQL_TEST_DIR/var/tmp/data2.tmp
SELECT @v19, @v20;
SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
#
# Bug #15881: cast problems
......
......@@ -31,13 +31,13 @@ select load_file(concat(@tmpdir,"/outfile-test.3"));
# the following should give errors
disable_query_log;
--error 1086
--error ER_FILE_EXISTS_ERROR
eval select * into outfile "../tmp/outfile-test.1" from t1;
--error 1086
--error ER_FILE_EXISTS_ERROR
eval select * into dumpfile "../tmp/outfile-test.2" from t1;
--error 1086
--error ER_FILE_EXISTS_ERROR
eval select * into dumpfile "../tmp/outfile-test.3" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
......@@ -92,7 +92,7 @@ use test;
# It should not be possible to write to a file outside of vardir
create table t1(a int);
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1;
drop table t1;
......@@ -105,7 +105,7 @@ create user user_1@localhost;
grant all on mysqltest.* to user_1@localhost;
connect (con28181_1,localhost,user_1,,mysqltest);
--error 1044
--error ER_DBACCESS_DENIED_ERROR
eval select schema_name
into outfile "../tmp/outfile-test.4"
fields terminated by ',' optionally enclosed by '"'
......@@ -125,7 +125,7 @@ from information_schema.schemata
where schema_name like 'mysqltest';
connection default;
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
use test;
revoke all privileges on *.* from user_1@localhost;
drop user user_1@localhost;
......
......@@ -74,12 +74,12 @@ create database mysqltest;
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
# temporarily disabled as it returns different result in the embedded server
# --error 1210, 1210
# --error ER_WRONG_ARGUMENTS, ER_WRONG_ARGUMENTS
# create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
# Should fail becasue the file t9.MYI already exist in 'run'
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1,1,1105
--error 1,1,ER_UNKNOWN_ERROR
eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="$MYSQLTEST_VARDIR/run";
# Should fail becasue the file t9.MYD already exist in 'tmp'
......@@ -195,19 +195,19 @@ DROP TABLE t1;
# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
#
--replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1210
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
--replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1210
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/test';
--replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1210
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/';
--replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1210
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data';
--replace_result $MYSQLTEST_VARDIR TEST_DIR
......
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