Debian Codegraph @

mysql-test/suite/ndb/t/ndb_partition_error.test

raw
1 -- source include/have_ndb.inc
2
3 # Turn on support for the "new" extended partition syntax
4 set new=on;
5
6 #
7 # Partition by range, generate node group error
8 #
9 --error ER_CANT_CREATE_TABLE
10 CREATE TABLE t1 (
11 a int not null,
12 b int not null,
13 c int not null,
14 primary key(a,b),
15 index (a))
16 engine = ndb
17 partition by range (a)
18 partitions 3
19 (partition x1 values less than (5) nodegroup 12,
20 partition x2 values less than (10) nodegroup 13,
21 partition x3 values less than (20) nodegroup 14);
22 show warnings;
23
24 #
25 # Partition by range, create normal valid table
26 #
27 CREATE TABLE t1 (
28 a int not null,
29 b int not null,
30 c int not null,
31 primary key(a))
32 engine = ndb
33 partition by range (a)
34 partitions 3
35 (partition x1 values less than (5),
36 partition x2 values less than (10),
37 partition x3 values less than (20));
38
39 drop table t1;
40
41 #
42 # Bug #17763 mysqld cores with list partitioning if update to missing partition
43 #
44 CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=NDB
45 PARTITION BY LIST(id)
46 (PARTITION p0 VALUES IN (2, 4),
47 PARTITION p1 VALUES IN (42, 142));
48 INSERT INTO t1 VALUES (2);
49 --error ER_NO_PARTITION_FOR_GIVEN_VALUE
50 UPDATE t1 SET id=5 WHERE id=2;
51 DROP TABLE t1;
52
53 #
54 # NULL for LIST partition
55 #
56 create table t1 (a int,b int, c int, primary key(a))
57 engine = ndb
58 partition by list(a)
59 partitions 2
60 (partition x123 values in (11, 12),
61 partition x234 values in (5, 1));
62 --error ER_BAD_NULL_ERROR,ER_NO_PARTITION_FOR_GIVEN_VALUE
63 insert into t1 values (NULL,1,1);
64 drop table t1;
65
66 #
67 # test bug#53354 - crash when creating partitioned table with multiple columns in the partition key
68 #
69
70 --error ER_SAME_NAME_PARTITION_FIELD
71 create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`);
72
73 --echo #
74 --echo # Bug#32773358 CREATE TABLE PARTITION FUNCTION CLEANUP
75 --echo # - test LIST and RANGE partition setup during CREATE TABLE
76 --echo #
77 # LIST partition
78 # Table with VALUES just within limits
79 CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB
80 PARTITION BY LIST(id)
81 (PARTITION p0 VALUES IN (0),
82 PARTITION p1 VALUES IN (NULL), -- Will not create partition
83 PARTITION p2 VALUES IN (2147483647),
84 PARTITION p3 VALUES IN (-2147483648));
85 INSERT INTO t1 VALUES(0);
86 INSERT INTO t1 VALUES(2147483647);
87 INSERT INTO t1 VALUES(-2147483648);
88 DROP TABLE t1;
89 # Exceed max limits
90 --error ER_LIMITED_PART_RANGE
91 CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB
92 PARTITION BY LIST(id)
93 (PARTITION p0 VALUES IN (0),
94 PARTITION p2 VALUES IN (2147483648));
95 # Exceed min limits
96 --error ER_LIMITED_PART_RANGE
97 CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB
98 PARTITION BY LIST(id)
99 (PARTITION p0 VALUES IN (0),
100 PARTITION p2 VALUES IN (-2147483649));
101
102 # RANGE partition
103 # Table with VALUES just within limits
104 CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB
105 PARTITION BY RANGE(id)
106 (PARTITION p1 VALUES LESS THAN (-2147483648),
107 PARTITION p2 VALUES LESS THAN (0),
108 PARTITION p3 VALUES LESS THAN (256),
109 PARTITION p4 VALUES LESS THAN (2147483646),
110 PARTITION p5 VALUES LESS THAN MAXVALUE);
111 INSERT INTO t1 VALUES(-2147483648);
112 INSERT INTO t1 VALUES(0);
113 INSERT INTO t1 VALUES(256);
114 INSERT INTO t1 VALUES(2147483647);
115 DROP TABLE t1;
116 # Exceed min limits
117 --error ER_LIMITED_PART_RANGE
118 CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB
119 PARTITION BY RANGE(id)
120 (PARTITION p1 VALUES LESS THAN (-2147483649),
121 PARTITION p2 VALUES LESS THAN MAXVALUE);
122 # Exceed max limits
123 --error ER_LIMITED_PART_RANGE
124 CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB
125 PARTITION BY RANGE(id)
126 (PARTITION p1 VALUES LESS THAN (2147483647),
127 PARTITION p2 VALUES LESS THAN MAXVALUE);