|
|
|
@@ -5,7 +5,7 @@
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
drop table if exists t1,t2;
|
|
|
|
|
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innobase;
|
|
|
|
|
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb;
|
|
|
|
|
|
|
|
|
|
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
|
|
|
|
|
select id, code, name from t1 order by id;
|
|
|
|
@@ -28,7 +28,7 @@ CREATE TABLE t1 (
|
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
|
KEY parent_id (parent_id),
|
|
|
|
|
KEY level (level)
|
|
|
|
|
) type=innobase;
|
|
|
|
|
) type=innodb;
|
|
|
|
|
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
|
|
|
|
|
update t1 set parent_id=parent_id+100;
|
|
|
|
|
select * from t1 where parent_id=102;
|
|
|
|
@@ -57,7 +57,7 @@ CREATE TABLE t1 (
|
|
|
|
|
gesuchnr int(11) DEFAULT '0' NOT NULL,
|
|
|
|
|
benutzer_id int(11) DEFAULT '0' NOT NULL,
|
|
|
|
|
PRIMARY KEY (gesuchnr,benutzer_id)
|
|
|
|
|
) type=innobase;
|
|
|
|
|
) type=innodb;
|
|
|
|
|
|
|
|
|
|
replace into t1 (gesuchnr,benutzer_id) values (2,1);
|
|
|
|
|
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
|
|
|
@@ -69,7 +69,7 @@ drop table t1;
|
|
|
|
|
# test delete using hidden_primary_key
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
create table t1 (a int) type=innobase;
|
|
|
|
|
create table t1 (a int) type=innodb;
|
|
|
|
|
insert into t1 values (1), (2);
|
|
|
|
|
optimize table t1;
|
|
|
|
|
delete from t1 where a = 1;
|
|
|
|
@@ -77,7 +77,7 @@ select * from t1;
|
|
|
|
|
check table t1;
|
|
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
|
|
create table t1 (a int,b varchar(20)) type=innobase;
|
|
|
|
|
create table t1 (a int,b varchar(20)) type=innodb;
|
|
|
|
|
insert into t1 values (1,""), (2,"testing");
|
|
|
|
|
delete from t1 where a = 1;
|
|
|
|
|
select * from t1;
|
|
|
|
@@ -90,7 +90,7 @@ drop table t1;
|
|
|
|
|
|
|
|
|
|
# Test of reading on secondary key with may be null
|
|
|
|
|
|
|
|
|
|
create table t1 (a int,b varchar(20),key(a)) type=innobase;
|
|
|
|
|
create table t1 (a int,b varchar(20),key(a)) type=innodb;
|
|
|
|
|
insert into t1 values (1,""), (2,"testing");
|
|
|
|
|
select * from t1 where a = 1;
|
|
|
|
|
drop table t1;
|
|
|
|
@@ -99,7 +99,7 @@ drop table t1;
|
|
|
|
|
# Test rollback
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
create table t1 (n int not null primary key) type=innobase;
|
|
|
|
|
create table t1 (n int not null primary key) type=innodb;
|
|
|
|
|
set autocommit=0;
|
|
|
|
|
insert into t1 values (4);
|
|
|
|
|
rollback;
|
|
|
|
@@ -126,7 +126,7 @@ drop table t1;
|
|
|
|
|
# Testing transactions
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innobase;
|
|
|
|
|
create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innodb;
|
|
|
|
|
begin;
|
|
|
|
|
insert into t1 values(1,'hamdouni');
|
|
|
|
|
select id as afterbegin_id,nom as afterbegin_nom from t1;
|
|
|
|
@@ -144,7 +144,7 @@ drop table t1;
|
|
|
|
|
# Simple not autocommit test
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=innobase;
|
|
|
|
|
CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=innodb;
|
|
|
|
|
insert into t1 values ('pippo', 12);
|
|
|
|
|
-- error 1062
|
|
|
|
|
insert into t1 values ('pippo', 12); # Gives error
|
|
|
|
@@ -167,12 +167,12 @@ set autocommit=1;
|
|
|
|
|
# The following simple tests failed at some point
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=innobase;
|
|
|
|
|
CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=innodb;
|
|
|
|
|
INSERT INTO t1 VALUES (1, 'Jochen');
|
|
|
|
|
select * from t1;
|
|
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=innobase;
|
|
|
|
|
CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=innodb;
|
|
|
|
|
set autocommit=0;
|
|
|
|
|
INSERT INTO t1 SET _userid='marc@anyware.co.uk';
|
|
|
|
|
COMMIT;
|
|
|
|
@@ -191,7 +191,7 @@ CREATE TABLE t1 (
|
|
|
|
|
ref_email varchar(100) DEFAULT '' NOT NULL,
|
|
|
|
|
detail varchar(200),
|
|
|
|
|
PRIMARY KEY (user_id,ref_email)
|
|
|
|
|
)type=innobase;
|
|
|
|
|
)type=innodb;
|
|
|
|
|
|
|
|
|
|
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
|
|
|
|
|
select * from t1 where user_id=10292;
|
|
|
|
@@ -212,11 +212,11 @@ show index from t1;
|
|
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Test of ALTER TABLE and innobase tables
|
|
|
|
|
# Test of ALTER TABLE and innodb tables
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
|
|
|
|
|
alter table t1 type=innobase;
|
|
|
|
|
alter table t1 type=innodb;
|
|
|
|
|
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
|
|
|
|
|
select * from t1;
|
|
|
|
|
update t1 set col2='7' where col1='4';
|
|
|
|
@@ -228,10 +228,10 @@ select * from t1;
|
|
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# INSERT INTO innobase tables
|
|
|
|
|
# INSERT INTO innodb tables
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
create table t1 (a int not null , b int, primary key (a)) type = innobase;
|
|
|
|
|
create table t1 (a int not null , b int, primary key (a)) type = innodb;
|
|
|
|
|
create table t2 (a int not null , b int, primary key (a)) type = myisam;
|
|
|
|
|
insert into t1 VALUES (1,3) , (2,3), (3,3);
|
|
|
|
|
select * from t1;
|
|
|
|
@@ -255,7 +255,7 @@ CREATE TABLE t1 (
|
|
|
|
|
passwd varchar(32) binary DEFAULT '' NOT NULL,
|
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
|
UNIQUE ggid (ggid)
|
|
|
|
|
) TYPE=innobase;
|
|
|
|
|
) TYPE=innodb;
|
|
|
|
|
|
|
|
|
|
insert into t1 (ggid,passwd) values ('test1','xxx');
|
|
|
|
|
insert into t1 (ggid,passwd) values ('test2','yyy');
|
|
|
|
@@ -293,7 +293,7 @@ CREATE TABLE t1 (
|
|
|
|
|
approved datetime,
|
|
|
|
|
dummy_primary_key int(11) NOT NULL auto_increment,
|
|
|
|
|
PRIMARY KEY (dummy_primary_key)
|
|
|
|
|
) TYPE=innobase;
|
|
|
|
|
) TYPE=innodb;
|
|
|
|
|
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
|
|
|
|
|
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
|
|
|
|
|
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
|
|
|
|
@@ -313,7 +313,7 @@ CREATE TABLE t1 (
|
|
|
|
|
KEY (id),
|
|
|
|
|
KEY parent_id (parent_id),
|
|
|
|
|
KEY level (level)
|
|
|
|
|
) type=innobase;
|
|
|
|
|
) type=innodb;
|
|
|
|
|
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
|
|
|
|
|
INSERT INTO t1 values (179,5,2);
|
|
|
|
|
update t1 set parent_id=parent_id+100;
|
|
|
|
@@ -346,7 +346,7 @@ CREATE TABLE t1 (
|
|
|
|
|
sca_sch_desc varchar(16),
|
|
|
|
|
PRIMARY KEY (sca_code, cat_code, lan_code),
|
|
|
|
|
INDEX sca_pic (sca_pic)
|
|
|
|
|
) type = innobase ;
|
|
|
|
|
) type = innodb ;
|
|
|
|
|
|
|
|
|
|
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
|
|
|
|
|
select count(*) from t1 where sca_code = 'PD';
|
|
|
|
@@ -368,7 +368,7 @@ drop table t1;
|
|
|
|
|
# Test of opening table twice and timestamps
|
|
|
|
|
#
|
|
|
|
|
set @a:=now();
|
|
|
|
|
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=innobase;
|
|
|
|
|
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=innodb;
|
|
|
|
|
insert into t1 (a) values(1),(2),(3);
|
|
|
|
|
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
|
|
|
|
|
update t1 set a=5 where a=1;
|
|
|
|
@@ -378,7 +378,7 @@ drop table t1;
|
|
|
|
|
#
|
|
|
|
|
# Test with variable length primary key
|
|
|
|
|
#
|
|
|
|
|
create table t1 (a varchar(100) not null, primary key(a), b int not null) type=innobase;
|
|
|
|
|
create table t1 (a varchar(100) not null, primary key(a), b int not null) type=innodb;
|
|
|
|
|
insert into t1 values("hello",1),("world",2);
|
|
|
|
|
select * from t1 order by b desc;
|
|
|
|
|
optimize table t1;
|
|
|
|
@@ -388,7 +388,7 @@ drop table t1;
|
|
|
|
|
#
|
|
|
|
|
# Test of create index with NULL columns
|
|
|
|
|
#
|
|
|
|
|
create table t1 (i int, j int ) TYPE=innobase;
|
|
|
|
|
create table t1 (i int, j int ) TYPE=innodb;
|
|
|
|
|
insert into t1 values (1,2);
|
|
|
|
|
select * from t1 where i=1 and j=2;
|
|
|
|
|
create index ax1 on t1 (i,j);
|
|
|
|
@@ -403,17 +403,29 @@ CREATE TABLE t1 (
|
|
|
|
|
a int3 unsigned NOT NULL,
|
|
|
|
|
b int1 unsigned NOT NULL,
|
|
|
|
|
UNIQUE (a, b)
|
|
|
|
|
) TYPE = innobase;
|
|
|
|
|
) TYPE = innodb;
|
|
|
|
|
|
|
|
|
|
INSERT INTO t1 VALUES (1, 1);
|
|
|
|
|
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
|
|
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Test INSERT DELAYED
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
CREATE TABLE t1 (a int unsigned NOT NULL) type=innodb;
|
|
|
|
|
--error 1031
|
|
|
|
|
INSERT DELAYED INTO t1 VALUES (1);
|
|
|
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Crash when using many tables (Test case by Jeremy D Zawodny)
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = Innobase;
|
|
|
|
|
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
|
|
|
|
|
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
|
|
|
|
|
explain select * from t1 where a > 0 and a < 50;
|
|
|
|
|
drop table t1;
|
|
|
|
|