mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge with 4.0.13
This commit is contained in:
@ -45,12 +45,9 @@ update ignore t1 set id=id+1; # This will change all rows
|
||||
select * from t1;
|
||||
update ignore t1 set id=1023 where id=1010;
|
||||
select * from t1 where parent_id=102;
|
||||
--replace_result 12 # 6 #
|
||||
explain select level from t1 where level=1;
|
||||
--replace_result 12 # 6 #
|
||||
explain select level,id from t1 where level=1;
|
||||
--replace_result 12 # 6 # 5 #
|
||||
explain select level,id,parent_id from t1 where level=1;
|
||||
# explain select level from t1 where level=1;
|
||||
# explain select level,id from t1 where level=1;
|
||||
# explain select level,id,parent_id from t1 where level=1;
|
||||
select level,id from t1 where level=1;
|
||||
select level,id,parent_id from t1 where level=1;
|
||||
optimize table t1;
|
||||
@ -348,7 +345,7 @@ update ignore t1 set id=id+1; # This will change all rows
|
||||
select * from t1;
|
||||
update ignore t1 set id=1023 where id=1010;
|
||||
select * from t1 where parent_id=102;
|
||||
explain select level from t1 where level=1;
|
||||
# explain select level from t1 where level=1;
|
||||
select level,id from t1 where level=1;
|
||||
select level,id,parent_id from t1 where level=1;
|
||||
select level,id from t1 where level=1 order by id;
|
||||
@ -784,7 +781,7 @@ drop table t1;
|
||||
|
||||
CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) type=innodb;
|
||||
CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) type=innodb;
|
||||
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
||||
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
|
||||
INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
||||
|
||||
# Full join, without key
|
||||
@ -800,11 +797,77 @@ update t1,t2 set t1.b=t1.b+10 where t1.b=2;
|
||||
select * from t1;
|
||||
|
||||
# Range key (in t1)
|
||||
update t1,t2 set t1.b=t1.b+2,t2.b=t1.b where t1.b between 3 and 5;
|
||||
update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) TYPE=MyISAM;
|
||||
CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) TYPE=InnoDB;
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 ( B_ID ) VALUES ( 1 );
|
||||
INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
|
||||
-- error 1196
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
drop table t1,t2;
|
||||
create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) type = innodb;
|
||||
insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
|
||||
select distinct parent,child from t1 order by parent;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test that MySQL priorities clustered indexes
|
||||
#
|
||||
create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) type=innodb;
|
||||
create table t2 (a int not null auto_increment primary key, b int);
|
||||
insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (b) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
select count(*) from t1;
|
||||
explain select * from t1 where c between 1 and 10000;
|
||||
update t1 set c=a;
|
||||
explain select * from t1 where c between 1 and 10000;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test of UPDATE ... ORDER BY
|
||||
#
|
||||
|
||||
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb;
|
||||
|
||||
insert into t1 (id) values (null),(null),(null),(null),(null);
|
||||
update t1 set fk=69 where fk is null order by id limit 1;
|
||||
SELECT * from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int not null, b int not null, key (a));
|
||||
insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
|
||||
SET @tmp=0;
|
||||
update t1 set b=(@tmp:=@tmp+1) order by a;
|
||||
update t1 set b=99 where a=1 order by b asc limit 1;
|
||||
update t1 set b=100 where a=1 order by b desc limit 2;
|
||||
update t1 set a=a+10+b where a=1 order by b;
|
||||
select * from t1 order by a,b;
|
||||
drop table t1;
|
||||
|
||||
|
||||
CREATE TABLE t1 (col1 int(1))TYPE=InnoDB;
|
||||
CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP(+0),INDEX stamp_idx
|
||||
(stamp))TYPE=InnoDB;
|
||||
|
Reference in New Issue
Block a user