Commit 588cf67d authored by unknown's avatar unknown
Browse files

Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/home/psergey/mysql-5.1-ppruning-r5

parents 61946d22 d09ca3ce
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11366,3 +11366,4 @@ col1
a
a
a
drop table t1;
+7 −0
Original line number Diff line number Diff line
@@ -271,3 +271,10 @@ t1 CREATE TABLE `t1` (
  `b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (6) ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN (8) ENGINE = MyISAM, PARTITION x4 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION x5 VALUES LESS THAN (12) ENGINE = MyISAM, PARTITION x6 VALUES LESS THAN (14) ENGINE = MyISAM, PARTITION x7 VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION x8 VALUES LESS THAN (18) ENGINE = MyISAM, PARTITION x9 VALUES LESS THAN (20) ENGINE = MyISAM)
drop table t1;
create table t1 (a int not null, b int not null) partition by LIST (a+b) (
partition p0 values in (12),
partition p1 values in (14)
);
insert into t1 values (10,1);
ERROR HY000: Table has no partition for value 11
drop table t1;
+45 −0
Original line number Diff line number Diff line
@@ -259,3 +259,48 @@ explain partitions select * from t1 where a is not null;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	2	Using where
drop table t1;
create table t1 (a int not null, b int not null, key(a), key(b))
partition by hash(a) partitions 4;
insert into t1 values (1,1),(2,2),(3,3),(4,4);
explain partitions 
select * from t1 X, t1 Y 
where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	X	p1,p2	ALL	a,b	NULL	NULL	NULL	4	Using where
1	SIMPLE	Y	p2,p3	ref	a,b	b	4	test.X.b	2	Using where
explain partitions
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	X	p1,p2	ALL	a	NULL	NULL	NULL	4	Using where
1	SIMPLE	Y	p1,p2	ref	a	a	4	test.X.a	2	
drop table t1;
create table t1 (a int) partition by hash(a) partitions 20;
insert into t1 values (1),(2),(3);
explain partitions select * from t1 where a >  1 and a < 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t1 where a >= 1 and a < 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t1 where a >  1 and a <= 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t1 where a >= 1 and a <= 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p1,p2,p3	ALL	NULL	NULL	NULL	NULL	3	Using where
drop table t1;
create table t1 (a int, b int) 
partition by list(a) subpartition by hash(b) subpartitions 20 
(
partition p0 values in (0),
partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3)
);
insert into t1 values (1,1),(2,2),(3,3);
explain partitions select * from t1 where b >  1 and b < 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0_sp2,p1_sp2,p2_sp2,p3_sp2	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t1 where b >  1 and b < 3 and (a =1 or a =2);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p1_sp2,p2_sp2	ALL	NULL	NULL	NULL	NULL	3	Using where
+10 −0
Original line number Diff line number Diff line
@@ -343,3 +343,13 @@ ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
show create table t1;
drop table t1;

# Testcase for BUG#15819
create table t1 (a int not null, b int not null) partition by LIST (a+b) (
  partition p0 values in (12),
  partition p1 values in (14)
);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
insert into t1 values (10,1);

drop table t1;
+37 −1
Original line number Diff line number Diff line
@@ -230,9 +230,45 @@ create table t1 (a int) partition by hash(a) partitions 2;
insert into t1 values (1),(2);
explain partitions select * from t1 where a is null;

# this selects both
# this uses both partitions
explain partitions select * from t1 where a is not null;
drop table t1;

# Join tests
create table t1 (a int not null, b int not null, key(a), key(b))
  partition by hash(a) partitions 4;
insert into t1 values (1,1),(2,2),(3,3),(4,4);

explain partitions 
select * from t1 X, t1 Y 
where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);

explain partitions
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);

drop table t1;

# Tests for "short ranges"
create table t1 (a int) partition by hash(a) partitions 20;
insert into t1 values (1),(2),(3);
explain partitions select * from t1 where a >  1 and a < 3;
explain partitions select * from t1 where a >= 1 and a < 3;
explain partitions select * from t1 where a >  1 and a <= 3;
explain partitions select * from t1 where a >= 1 and a <= 3;
drop table t1;

create table t1 (a int, b int) 
 partition by list(a) subpartition by hash(b) subpartitions 20 
(
  partition p0 values in (0),
  partition p1 values in (1),
  partition p2 values in (2),
  partition p3 values in (3)
);
insert into t1 values (1,1),(2,2),(3,3);

explain partitions select * from t1 where b >  1 and b < 3;
explain partitions select * from t1 where b >  1 and b < 3 and (a =1 or a =2);

# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
# being fixed.
Loading