1
-- source include/have_ndb.inc
4
DROP TABLE IF EXISTS t1;
11
# Support for partition key verified
12
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
14
PARTITION BY KEY (a,b);
16
insert into t1 values (1,1,1,1);
18
update t1 set d = 2 where a = 1 and b = 1 and c = 1;
25
# only support for partition key on primary key
26
--error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
27
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
31
CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY(a,b))
36
(1,1,3),(1,2,3),(1,3,3),(1,4,3),(1,5,3),(1,6,3),
37
(1,7,3),(1,8,3),(1,9,3),(1,10,3),(1,11,3),(1,12,3);
39
select * from t1 order by b;
41
# BUG#33061: ORDER BY DESC becomes ASC in NDB partition pruning to one partition
42
select max(b) from t1 where a = 1;
43
select b from t1 where a = 1 order by b desc;
48
# Test partition and char support
51
CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
52
PRIMARY KEY (a,b,c) USING HASH)
54
DEFAULT CHARSET=latin1
57
insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
59
# should show only one attribute with DISTRIBUTION KEY
60
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | sed 's/Version: [0-9]*//' | sed 's/\(Length of frm data: \)[0-9]*/\1#/'
63
# Test that explicit partition info is not shown in show create table
64
# result should not contain (PARTITION P0 ... etc) since this is what shows up in
65
# mysqldump, and we don't want that info there
72
# Bug #13155: Problem in Create Table using SHOW CREATE TABLE syntax
74
CREATE TABLE t1 (a int not null primary key)
76
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
80
CREATE TABLE t1 (a int not null primary key);
84
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
88
CREATE TABLE t1 (a int not null primary key) ENGINE = NDB;
91
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
96
# Bug #17754 Improper handling of removal of partitioning in ALTER TABLE
97
# Also added a number of general test cases in the same area
99
create table t1 (a int)
102
(partition p0, partition p1);
103
show create table t1;
105
alter table t1 engine=heap;
106
show create table t1;
108
alter table t1 engine=ndb;
109
show create table t1;
111
alter table t1 engine=heap remove partitioning;
112
show create table t1;
114
alter table t1 engine=ndb
116
(partition p0, partition p1 engine = ndb);
117
show create table t1;
121
(partition p0 engine=ndb, partition p1 engine=ndb);
122
show create table t1;
124
alter table t1 remove partitioning;
125
show create table t1;
127
# after bug#31931 was fixed
128
# this is OK, since the storage engine is specified
129
# on table level before.
130
#--error ER_MIX_HANDLER_ERROR
133
(partition p0 engine=ndb, partition p1);
138
(partition p0 engine=ndb, partition p1 engine = ndb);
139
show create table t1;
144
# BUG 16810 Out of memory when coalesce partition
147
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
156
PARTITION BY KEY(c3) PARTITIONS 5;
162
eval INSERT INTO t1 VALUES (NULL, "Tested Remotely from Texas, USA", $j,
164
$j.00,"By JBM $j","2006-01-26");
168
ALTER TABLE t1 COALESCE PARTITION 4;
173
# Bug 16822: OPTIMIZE TABLE hangs test
175
CREATE TABLE t1 (a int primary key)
182
ALTER TABLE t1 OPTIMIZE PARTITION p0;
183
ALTER TABLE t1 CHECK PARTITION p0;
184
ALTER TABLE t1 REPAIR PARTITION p0;
185
ALTER TABLE t1 ANALYZE PARTITION p0;
186
--error ER_ILLEGAL_HA
187
ALTER TABLE t1 REBUILD PARTITION p0;
191
# BUG 16806: ALTER TABLE fails
194
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
199
PARTITION BY KEY(c3) PARTITIONS 5;
201
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
205
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
211
(PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0);
213
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
214
SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE
221
a tinyint unsigned NOT NULL,
222
b bigint(20) unsigned NOT NULL,
225
) ENGINE ndb DEFAULT CHARSET=latin1 PARTITION BY KEY (a);
227
insert into t1 values(1,1,'1'), (2,2,'2'), (3,3,'3'), (4,4,'4'), (5,5,'5');
228
select * from t1 where a = 1;
229
select * from t1 where a = 2;
230
select * from t1 where a = 3;
231
select * from t1 where a = 4;
232
select * from t1 where a = 5;
233
delete from t1 where a = 1;
234
select * from t1 order by 1;
235
delete from t1 where a = 2;
236
select * from t1 order by 1;
237
delete from t1 where a = 3;
238
select * from t1 order by 1;
239
delete from t1 where a = 4;
240
select * from t1 order by 1;
241
delete from t1 where a = 5;
242
select * from t1 order by 1;