mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
c9472ee254
Bug # 17894 - Comparison with "less than" operator fails with range partition The problem here was that on queries such as < 3, the range given is NULL < n < 3. The null part works correctly where the null value is stored in rec[0] and the field is marked as being null. However, when the 3 is processed, the 3 is places on rec[0] but the null flag is left uncleared. partition_range.result: Results block for bug #17894 partition_range.test: Test block for bug #17894 partition_list.result: Results block for bug #17173 partition_list.test: Test block for bug #17173 opt_range.cc: call set_notnull to clear any null flag that may have been set
193 lines
3 KiB
Text
193 lines
3 KiB
Text
drop table if exists t1;
|
|
CREATE TABLE t1 (
|
|
a int not null,
|
|
b int not null,
|
|
c int not null)
|
|
partition by list(a)
|
|
partitions 2
|
|
(partition x123 values in (1,5,6),
|
|
partition x234 values in (4,7,8));
|
|
INSERT into t1 VALUES (1,1,1);
|
|
INSERT into t1 VALUES (2,1,1);
|
|
ERROR HY000: Table has no partition for value 2
|
|
INSERT into t1 VALUES (3,1,1);
|
|
ERROR HY000: Table has no partition for value 3
|
|
INSERT into t1 VALUES (4,1,1);
|
|
INSERT into t1 VALUES (5,1,1);
|
|
INSERT into t1 VALUES (6,1,1);
|
|
INSERT into t1 VALUES (7,1,1);
|
|
INSERT into t1 VALUES (8,1,1);
|
|
INSERT into t1 VALUES (9,1,1);
|
|
ERROR HY000: Table has no partition for value 9
|
|
INSERT into t1 VALUES (1,2,1);
|
|
INSERT into t1 VALUES (1,3,1);
|
|
INSERT into t1 VALUES (1,4,1);
|
|
INSERT into t1 VALUES (7,2,1);
|
|
INSERT into t1 VALUES (7,3,1);
|
|
INSERT into t1 VALUES (7,4,1);
|
|
SELECT * from t1;
|
|
a b c
|
|
1 1 1
|
|
5 1 1
|
|
6 1 1
|
|
1 2 1
|
|
1 3 1
|
|
1 4 1
|
|
4 1 1
|
|
7 1 1
|
|
8 1 1
|
|
7 2 1
|
|
7 3 1
|
|
7 4 1
|
|
SELECT * from t1 WHERE a=1;
|
|
a b c
|
|
1 1 1
|
|
1 2 1
|
|
1 3 1
|
|
1 4 1
|
|
SELECT * from t1 WHERE a=7;
|
|
a b c
|
|
7 1 1
|
|
7 2 1
|
|
7 3 1
|
|
7 4 1
|
|
SELECT * from t1 WHERE b=2;
|
|
a b c
|
|
1 2 1
|
|
7 2 1
|
|
UPDATE t1 SET a=8 WHERE a=7 AND b=3;
|
|
SELECT * from t1;
|
|
a b c
|
|
1 1 1
|
|
5 1 1
|
|
6 1 1
|
|
1 2 1
|
|
1 3 1
|
|
1 4 1
|
|
4 1 1
|
|
7 1 1
|
|
8 1 1
|
|
7 2 1
|
|
8 3 1
|
|
7 4 1
|
|
UPDATE t1 SET a=8 WHERE a=5 AND b=1;
|
|
SELECT * from t1;
|
|
a b c
|
|
1 1 1
|
|
6 1 1
|
|
1 2 1
|
|
1 3 1
|
|
1 4 1
|
|
4 1 1
|
|
7 1 1
|
|
8 1 1
|
|
7 2 1
|
|
8 3 1
|
|
7 4 1
|
|
8 1 1
|
|
DELETE from t1 WHERE a=8;
|
|
SELECT * from t1;
|
|
a b c
|
|
1 1 1
|
|
6 1 1
|
|
1 2 1
|
|
1 3 1
|
|
1 4 1
|
|
4 1 1
|
|
7 1 1
|
|
7 2 1
|
|
7 4 1
|
|
DELETE from t1 WHERE a=2;
|
|
SELECT * from t1;
|
|
a b c
|
|
1 1 1
|
|
6 1 1
|
|
1 2 1
|
|
1 3 1
|
|
1 4 1
|
|
4 1 1
|
|
7 1 1
|
|
7 2 1
|
|
7 4 1
|
|
DELETE from t1 WHERE a=5 OR a=6;
|
|
SELECT * from t1;
|
|
a b c
|
|
1 1 1
|
|
1 2 1
|
|
1 3 1
|
|
1 4 1
|
|
4 1 1
|
|
7 1 1
|
|
7 2 1
|
|
7 4 1
|
|
ALTER TABLE t1
|
|
partition by list(a)
|
|
partitions 2
|
|
(partition x123 values in (1,5,6),
|
|
partition x234 values in (4,7,8));
|
|
SELECT * from t1;
|
|
a b c
|
|
1 1 1
|
|
1 2 1
|
|
1 3 1
|
|
1 4 1
|
|
4 1 1
|
|
7 1 1
|
|
7 2 1
|
|
7 4 1
|
|
INSERT into t1 VALUES (6,2,1);
|
|
INSERT into t1 VALUES (2,2,1);
|
|
ERROR HY000: Table has no partition for value 2
|
|
drop table t1;
|
|
CREATE TABLE t1 (
|
|
a int not null,
|
|
b int not null,
|
|
c int not null,
|
|
primary key (a,b))
|
|
partition by list (a)
|
|
subpartition by hash (a+b)
|
|
( partition x1 values in (1,2,3)
|
|
( subpartition x11 nodegroup 0,
|
|
subpartition x12 nodegroup 1),
|
|
partition x2 values in (4,5,6)
|
|
( subpartition x21 nodegroup 0,
|
|
subpartition x22 nodegroup 1)
|
|
);
|
|
INSERT into t1 VALUES (1,1,1);
|
|
INSERT into t1 VALUES (4,1,1);
|
|
INSERT into t1 VALUES (7,1,1);
|
|
ERROR HY000: Table has no partition for value 7
|
|
UPDATE t1 SET a=5 WHERE a=1;
|
|
SELECT * from t1;
|
|
a b c
|
|
5 1 1
|
|
4 1 1
|
|
UPDATE t1 SET a=6 WHERE a=4;
|
|
SELECT * from t1;
|
|
a b c
|
|
5 1 1
|
|
6 1 1
|
|
DELETE from t1 WHERE a=6;
|
|
SELECT * from t1;
|
|
a b c
|
|
5 1 1
|
|
drop table t1;
|
|
CREATE TABLE t1 (
|
|
a int not null,
|
|
b int not null,
|
|
c int not null,
|
|
primary key(a,b))
|
|
partition by list (a)
|
|
(partition x1 values in (1,2,9,4) tablespace ts1);
|
|
drop table t1;
|
|
CREATE TABLE t1 (s1 int) PARTITION BY LIST (s1)
|
|
(PARTITION p1 VALUES IN (1),
|
|
PARTITION p2 VALUES IN (2),
|
|
PARTITION p3 VALUES IN (3),
|
|
PARTITION p4 VALUES IN (4),
|
|
PARTITION p5 VALUES IN (5));
|
|
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
|
|
SELECT COUNT(*) FROM t1 WHERE s1 < 3;
|
|
COUNT(*)
|
|
2
|
|
DROP TABLE t1;
|