mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
8a43d4afee
Added test case for bug 18423 mysql-test/r/partition_hash.result: Added test case for bug 18423 mysql-test/t/partition_hash.test: Added test case for bug 18423
101 lines
2.1 KiB
Text
101 lines
2.1 KiB
Text
drop table if exists t1;
|
|
CREATE TABLE t1 (
|
|
a int not null,
|
|
b int not null,
|
|
c int not null,
|
|
primary key(a,b))
|
|
partition by hash (a + 2)
|
|
partitions 3
|
|
(partition x1 tablespace ts1,
|
|
partition x2 tablespace ts2,
|
|
partition x3 tablespace ts3);
|
|
insert into t1 values (1,1,1);
|
|
insert into t1 values (2,1,1);
|
|
insert into t1 values (3,1,1);
|
|
insert into t1 values (4,1,1);
|
|
insert into t1 values (5,1,1);
|
|
select * from t1;
|
|
a b c
|
|
1 1 1
|
|
4 1 1
|
|
2 1 1
|
|
5 1 1
|
|
3 1 1
|
|
update t1 set c=3 where b=1;
|
|
select * from t1;
|
|
a b c
|
|
1 1 3
|
|
4 1 3
|
|
2 1 3
|
|
5 1 3
|
|
3 1 3
|
|
select b from t1 where a=3;
|
|
b
|
|
1
|
|
select b,c from t1 where a=1 AND b=1;
|
|
b c
|
|
1 3
|
|
delete from t1 where a=1;
|
|
delete from t1 where c=3;
|
|
select * from t1;
|
|
a b c
|
|
ALTER TABLE t1
|
|
partition by hash (a + 3)
|
|
partitions 3
|
|
(partition x1 tablespace ts1,
|
|
partition x2 tablespace ts2,
|
|
partition x3 tablespace ts3);
|
|
select * from t1;
|
|
a b c
|
|
drop table t1;
|
|
CREATE TABLE t1 (
|
|
a int not null,
|
|
b int not null,
|
|
c int not null,
|
|
primary key(a,b))
|
|
partition by hash (a)
|
|
(partition x1);
|
|
drop table t1;
|
|
CREATE TABLE t1 (
|
|
a int not null,
|
|
b int not null,
|
|
c int not null,
|
|
primary key(a,b))
|
|
partition by key (a)
|
|
(partition x1);
|
|
drop table t1;
|
|
CREATE TABLE t1 (f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM' PARTITION BY HASH(f1) PARTITIONS 2;
|
|
INSERT INTO t1 SET f1 = 0 - 1, f2 = '#######';
|
|
select * from t1;
|
|
f1 f2
|
|
-1 #######
|
|
drop table t1;
|
|
CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1);
|
|
INSERT INTO t1 VALUES (0);
|
|
DROP TABLE t1;
|
|
create table t1 (c1 int DEFAULT NULL,
|
|
c2 varchar (30) DEFAULT NULL,
|
|
c3 date DEFAULT NULL)
|
|
engine = myisam
|
|
partition by hash (to_days(c3))
|
|
partitions 12;
|
|
insert into t1 values
|
|
(136,'abc','2002-01-05'),(142,'abc','2002-02-14'),(162,'abc','2002-06-28'),
|
|
(182,'abc','2002-11-09'),(158,'abc','2002-06-01'),(184,'abc','2002-11-22');
|
|
select * from t1;
|
|
c1 c2 c3
|
|
136 abc 2002-01-05
|
|
158 abc 2002-06-01
|
|
142 abc 2002-02-14
|
|
162 abc 2002-06-28
|
|
182 abc 2002-11-09
|
|
184 abc 2002-11-22
|
|
select * from t1 where c3 between '2002-01-01' and '2002-12-31';
|
|
c1 c2 c3
|
|
136 abc 2002-01-05
|
|
158 abc 2002-06-01
|
|
142 abc 2002-02-14
|
|
162 abc 2002-06-28
|
|
182 abc 2002-11-09
|
|
184 abc 2002-11-22
|
|
drop table t1;
|