symlink.test 3 KB
Newer Older
1
-- require r/have_symlink.require
monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
2
disable_query_log;
3
show variables like "have_symlink";
monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
4
enable_query_log;
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

#
# First create little data to play with
#
drop table if exists t1,t2,t7,t8,t9;
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
drop table t2;

#
# Start the test
# We use t9 here to not crash with tables generated by the backup test
# 

monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
38
disable_query_log;
39
eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run";
monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
40 41
enable_query_log;

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
insert into t9 select * from t1;
check table t9;
optimize table t9;
repair table t9;
alter table t9 add column c int not null;
show create table t9;

# Test renames
alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
rename table t7 to t9;
# Drop old t1 table, keep t9
drop table t1;

#
# Test error handling
# Note that we are using the above table t9 here!
#

monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
61 62
disable_query_log;
--error 1103,1103
63 64 65 66 67 68 69
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";

# Check that we cannot link over a table from another database.

drop database if exists test_mysqltest;
create database test_mysqltest;

monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
70
--error 1,1
71 72
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";

monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
73
--error 1103,1103
74 75
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";

monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
76
--error 1,1
77 78
eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="$MYSQL_TEST_DIR/var/run";

monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
79
--error 1,1
80
eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp";
monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
81
enable_query_log;
82 83 84 85 86 87 88 89

# Check moving table t9 from default database to test_mysqltest;
# In this case the symlinks should be removed.

alter table t9 rename test_mysqltest.t9;
select count(*) from test_mysqltest.t9;
show create table test_mysqltest.t9;
drop database test_mysqltest;