mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 15:24:16 +01:00
175 lines
4 KiB
Text
175 lines
4 KiB
Text
|
--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;
|