2001-06-05 02:38:10 +02:00
-- require r/have_symlink.require
2001-11-28 02:47:15 +01:00
disable_query_log;
2001-06-05 02:38:10 +02:00
show variables like "have_symlink";
2001-11-28 02:47:15 +01:00
enable_query_log;
2001-06-05 02:38:10 +02:00
2003-01-06 00:48:59 +01:00
--disable_warnings
drop table if exists t1,t2,t7,t8,t9;
2003-07-03 10:55:36 +02:00
drop database if exists mysqltest;
2003-01-06 00:48:59 +01:00
--enable_warnings
2001-06-05 02:38:10 +02:00
#
# First create little data to play with
#
2003-01-06 00:48:59 +01:00
2001-06-05 02:38:10 +02:00
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
#
2001-11-28 02:47:15 +01:00
disable_query_log;
2003-12-10 05:31:42 +01:00
eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run";
2001-11-28 02:47:15 +01:00
enable_query_log;
2001-06-05 02:38:10 +02:00
insert into t9 select * from t1;
check table t9;
optimize table t9;
repair table t9;
alter table t9 add column c int not null;
2003-08-25 16:19:44 +02:00
--replace_result $MYSQL_TEST_DIR TEST_DIR
2001-06-05 02:38:10 +02:00
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!
#
2001-11-28 02:47:15 +01:00
disable_query_log;
2003-11-20 21:06:25 +01:00
--error 1103,1103
2003-12-10 05:31:42 +01:00
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
2001-06-05 02:38:10 +02:00
# Check that we cannot link over a table from another database.
2003-07-03 10:55:36 +02:00
create database mysqltest;
2001-06-05 02:38:10 +02:00
2001-11-28 02:47:15 +01:00
--error 1,1
2003-12-10 05:31:42 +01:00
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";
2001-06-05 02:38:10 +02:00
2003-11-20 21:06:25 +01:00
--error 1103,1103
2003-12-10 05:31:42 +01:00
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";
2001-06-05 02:38:10 +02:00
2001-11-28 02:47:15 +01:00
--error 1,1
2003-12-10 05:31:42 +01:00
eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="$MYSQL_TEST_DIR/var/run";
2001-06-05 02:38:10 +02:00
2001-11-28 02:47:15 +01:00
--error 1,1
2003-12-10 05:31:42 +01:00
eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp";
2001-11-28 02:47:15 +01:00
enable_query_log;
2001-06-05 02:38:10 +02:00
2003-07-03 10:55:36 +02:00
# Check moving table t9 from default database to mysqltest;
2001-06-05 02:38:10 +02:00
# In this case the symlinks should be removed.
2003-07-03 10:55:36 +02:00
alter table t9 rename mysqltest.t9;
select count(*) from mysqltest.t9;
2003-08-25 16:19:44 +02:00
--replace_result $MYSQL_TEST_DIR TEST_DIR
2003-07-03 10:55:36 +02:00
show create table mysqltest.t9;
drop database mysqltest;
2003-12-12 21:26:58 +01:00
#
# Test changing data dir (Bug #1662)
#
2004-02-17 01:26:35 +01:00
create table t1 (a int not null) engine=myisam;
2003-12-12 21:26:58 +01:00
disable_query_log;
eval alter table t1 data directory="$MYSQL_TEST_DIR/var/tmp";
enable_query_log;
--replace_result $MYSQL_TEST_DIR TEST_DIR
show create table t1;
alter table t1 add b int;
disable_query_log;
eval alter table t1 data directory="$MYSQL_TEST_DIR/var/log";
enable_query_log;
--replace_result $MYSQL_TEST_DIR TEST_DIR
show create table t1;
disable_query_log;
eval alter table t1 index directory="$MYSQL_TEST_DIR/var/log";
enable_query_log;
show create table t1;
drop table t1;