mariadb/mysql-test/suite/tokudb.bugs/t/fileops.test
Zardosht Kasheff f45f072491 [t:2918], add tests to a common directory
git-svn-id: file:///svn/mysql/tests/mysql-test@23577 c7de825b-a66e-492c-adef-691d508d4ae1
2010-09-07 16:06:33 +00:00

175 lines
No EOL
4 KiB
Text
Executable file

--source include/have_tokudb.inc
SET STORAGE_ENGINE = 'tokudb';
--disable_warnings
DROP TABLE IF EXISTS t1,t2;
--enable_warnings
#
# test create and drop
#
create table t1 (a int, b int, c int, key(a), key(b));
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
DROP TABLE t1;
#
# test create, open and drop
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
DROP TABLE t1;
#
# test create, rename, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
rename table t1 to t2;
DROP TABLE t2;
create table t1 (a int, b int, c int, primary key(a), key(b));
rename table t1 to t2;
DROP TABLE t2;
#
# test create, open, rename, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
rename table t1 to t2;
select * from t2;
DROP TABLE t2;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
rename table t1 to t2;
select * from t2;
DROP TABLE t2;
#
# test create, rename, open, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
rename table t1 to t2;
insert into t2 values (1,10,100);
select * from t2;
DROP TABLE t2;
create table t1 (a int, b int, c int, primary key(a), key(b));
rename table t1 to t2;
insert into t2 values (1,10,100);
select * from t2;
DROP TABLE t2;
#
# test create, add index, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
alter table t1 add index (c), add index (a,b);
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
alter table t1 add index (c), add index (a,b);
DROP TABLE t1;
#
# test create, drop index, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
alter table t1 drop index b;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
alter table t1 drop index b;
DROP TABLE t1;
#
# test add index, but with elements inserted and checked
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
alter table t1 add index (c), add index (a,b);
select c from t1;
select a,b from t1;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
alter table t1 add index (c), add index (a,b);
select c from t1;
select a,b from t1;
DROP TABLE t1;
#
# test create, add index, drop index, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
alter table t1 add index (c), add index (a,b), drop index b;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
alter table t1 add index (c), add index (a,b), drop index b;
DROP TABLE t1;
#
# test create, add index, drop index, drop, with elements
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
alter table t1 add index (c), add index foo (a,b), drop index b;
select c from t1;
select a,b from t1 use index (foo);
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
alter table t1 add index (c), add index foo (a,b), drop index b;
select c from t1;
select a,b from t1 use index (foo);
DROP TABLE t1;
#
# truncate
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
truncate table t1;
insert into t1 values (2,20,200);
select * from t1;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
truncate table t1;
insert into t1 values (2,20,200);
select * from t1;
DROP TABLE t1;
#
# do everything
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
alter table t1 add index (c), drop index b;
select c from t1;
rename table t1 to t2;
select * from t2;
alter table t2 add index (b), drop index c;
select b from t2;
truncate table t2;
insert into t2 values (2,20,200);
select * From t2;
drop table t2;