mirror of
https://github.com/MariaDB/server.git
synced 2025-09-11 05:52:26 +03:00
merge
This commit is contained in:
@@ -1,5 +1,54 @@
|
||||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#51830: Incorrect partition pruning on range partition (regression)
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL)
|
||||
ENGINE = InnoDB
|
||||
PARTITION BY RANGE(a)
|
||||
(PARTITION p10 VALUES LESS THAN (10),
|
||||
PARTITION p30 VALUES LESS THAN (30),
|
||||
PARTITION p50 VALUES LESS THAN (50),
|
||||
PARTITION p70 VALUES LESS THAN (70),
|
||||
PARTITION p90 VALUES LESS THAN (90));
|
||||
INSERT INTO t1 VALUES (10),(30),(50);
|
||||
INSERT INTO t1 VALUES (70);
|
||||
INSERT INTO t1 VALUES (80);
|
||||
INSERT INTO t1 VALUES (89);
|
||||
INSERT INTO t1 VALUES (90);
|
||||
ERROR HY000: Table has no partition for value 90
|
||||
INSERT INTO t1 VALUES (100);
|
||||
ERROR HY000: Table has no partition for value 100
|
||||
insert INTO t1 VALUES (110);
|
||||
ERROR HY000: Table has no partition for value 110
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#50104: Partitioned table with just 1 partion works with fk
|
||||
#
|
||||
CREATE TABLE t2 (
|
||||
|
@@ -2101,6 +2101,21 @@ insert into t7 values (10),(30),(50);
|
||||
explain partitions select * from t7 where a < 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a <= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a = 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2110,9 +2125,33 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a = 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t7 where a >= 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2122,6 +2161,9 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 91;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 11 and a < 29;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2137,6 +2179,21 @@ insert into t7 values (10),(30),(50);
|
||||
explain partitions select * from t7 where a < 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a <= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a = 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2146,9 +2203,33 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a = 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t7 where a >= 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2158,6 +2239,9 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 91;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 11 and a < 29;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
|
@@ -7,6 +7,38 @@ drop table if exists t1, t2;
|
||||
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#51830: Incorrect partition pruning on range partition (regression)
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT NOT NULL)
|
||||
ENGINE = InnoDB
|
||||
PARTITION BY RANGE(a)
|
||||
(PARTITION p10 VALUES LESS THAN (10),
|
||||
PARTITION p30 VALUES LESS THAN (30),
|
||||
PARTITION p50 VALUES LESS THAN (50),
|
||||
PARTITION p70 VALUES LESS THAN (70),
|
||||
PARTITION p90 VALUES LESS THAN (90));
|
||||
INSERT INTO t1 VALUES (10),(30),(50);
|
||||
INSERT INTO t1 VALUES (70);
|
||||
INSERT INTO t1 VALUES (80);
|
||||
INSERT INTO t1 VALUES (89);
|
||||
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
|
||||
INSERT INTO t1 VALUES (90);
|
||||
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
|
||||
INSERT INTO t1 VALUES (100);
|
||||
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
|
||||
insert INTO t1 VALUES (110);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#50104: Partitioned table with just 1 partion works with fk
|
||||
--echo #
|
||||
|
@@ -702,15 +702,29 @@ insert into t7 values (10),(30),(50);
|
||||
|
||||
# leftmost intervals
|
||||
explain partitions select * from t7 where a < 5;
|
||||
explain partitions select * from t7 where a < 9;
|
||||
explain partitions select * from t7 where a <= 9;
|
||||
explain partitions select * from t7 where a = 9;
|
||||
explain partitions select * from t7 where a >= 9;
|
||||
explain partitions select * from t7 where a > 9;
|
||||
explain partitions select * from t7 where a < 10;
|
||||
explain partitions select * from t7 where a <= 10;
|
||||
explain partitions select * from t7 where a = 10;
|
||||
explain partitions select * from t7 where a >= 10;
|
||||
explain partitions select * from t7 where a > 10;
|
||||
|
||||
#rightmost intervals
|
||||
explain partitions select * from t7 where a < 89;
|
||||
explain partitions select * from t7 where a <= 89;
|
||||
explain partitions select * from t7 where a = 89;
|
||||
explain partitions select * from t7 where a > 89;
|
||||
explain partitions select * from t7 where a >= 89;
|
||||
explain partitions select * from t7 where a < 90;
|
||||
explain partitions select * from t7 where a <= 90;
|
||||
explain partitions select * from t7 where a = 90;
|
||||
explain partitions select * from t7 where a > 90;
|
||||
explain partitions select * from t7 where a >= 90;
|
||||
explain partitions select * from t7 where a > 91;
|
||||
|
||||
# misc intervals
|
||||
explain partitions select * from t7 where a > 11 and a < 29;
|
||||
@@ -728,15 +742,29 @@ insert into t7 values (10),(30),(50);
|
||||
|
||||
# leftmost intervals
|
||||
explain partitions select * from t7 where a < 5;
|
||||
explain partitions select * from t7 where a < 9;
|
||||
explain partitions select * from t7 where a <= 9;
|
||||
explain partitions select * from t7 where a = 9;
|
||||
explain partitions select * from t7 where a >= 9;
|
||||
explain partitions select * from t7 where a > 9;
|
||||
explain partitions select * from t7 where a < 10;
|
||||
explain partitions select * from t7 where a <= 10;
|
||||
explain partitions select * from t7 where a = 10;
|
||||
explain partitions select * from t7 where a >= 10;
|
||||
explain partitions select * from t7 where a > 10;
|
||||
|
||||
#rightmost intervals
|
||||
explain partitions select * from t7 where a < 89;
|
||||
explain partitions select * from t7 where a <= 89;
|
||||
explain partitions select * from t7 where a = 89;
|
||||
explain partitions select * from t7 where a > 89;
|
||||
explain partitions select * from t7 where a >= 89;
|
||||
explain partitions select * from t7 where a < 90;
|
||||
explain partitions select * from t7 where a <= 90;
|
||||
explain partitions select * from t7 where a = 90;
|
||||
explain partitions select * from t7 where a > 90;
|
||||
explain partitions select * from t7 where a >= 90;
|
||||
explain partitions select * from t7 where a > 91;
|
||||
|
||||
# misc intervals
|
||||
explain partitions select * from t7 where a > 11 and a < 29;
|
||||
|
Reference in New Issue
Block a user