-- source include/have_ndb.inc # Turn on support for the "new" extended partition syntax set new=on; # # Partition by range, generate node group error # --error ER_CANT_CREATE_TABLE CREATE TABLE t1 ( a int not null, b int not null, c int not null, primary key(a,b), index (a)) engine = ndb partition by range (a) partitions 3 (partition x1 values less than (5) nodegroup 12, partition x2 values less than (10) nodegroup 13, partition x3 values less than (20) nodegroup 14); show warnings; # # Partition by range, create normal valid table # CREATE TABLE t1 ( a int not null, b int not null, c int not null, primary key(a)) engine = ndb partition by range (a) partitions 3 (partition x1 values less than (5), partition x2 values less than (10), partition x3 values less than (20)); drop table t1; # # Bug #17763 mysqld cores with list partitioning if update to missing partition # CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=NDB PARTITION BY LIST(id) (PARTITION p0 VALUES IN (2, 4), PARTITION p1 VALUES IN (42, 142)); INSERT INTO t1 VALUES (2); --error ER_NO_PARTITION_FOR_GIVEN_VALUE UPDATE t1 SET id=5 WHERE id=2; DROP TABLE t1; # # NULL for LIST partition # create table t1 (a int,b int, c int, primary key(a)) engine = ndb partition by list(a) partitions 2 (partition x123 values in (11, 12), partition x234 values in (5, 1)); --error ER_BAD_NULL_ERROR,ER_NO_PARTITION_FOR_GIVEN_VALUE insert into t1 values (NULL,1,1); drop table t1; # # test bug#53354 - crash when creating partitioned table with multiple columns in the partition key # --error ER_SAME_NAME_PARTITION_FIELD create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`); --echo # --echo # Bug#32773358 CREATE TABLE PARTITION FUNCTION CLEANUP --echo # - test LIST and RANGE partition setup during CREATE TABLE --echo # # LIST partition # Table with VALUES just within limits CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB PARTITION BY LIST(id) (PARTITION p0 VALUES IN (0), PARTITION p1 VALUES IN (NULL), -- Will not create partition PARTITION p2 VALUES IN (2147483647), PARTITION p3 VALUES IN (-2147483648)); INSERT INTO t1 VALUES(0); INSERT INTO t1 VALUES(2147483647); INSERT INTO t1 VALUES(-2147483648); DROP TABLE t1; # Exceed max limits --error ER_LIMITED_PART_RANGE CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB PARTITION BY LIST(id) (PARTITION p0 VALUES IN (0), PARTITION p2 VALUES IN (2147483648)); # Exceed min limits --error ER_LIMITED_PART_RANGE CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB PARTITION BY LIST(id) (PARTITION p0 VALUES IN (0), PARTITION p2 VALUES IN (-2147483649)); # RANGE partition # Table with VALUES just within limits CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB PARTITION BY RANGE(id) (PARTITION p1 VALUES LESS THAN (-2147483648), PARTITION p2 VALUES LESS THAN (0), PARTITION p3 VALUES LESS THAN (256), PARTITION p4 VALUES LESS THAN (2147483646), PARTITION p5 VALUES LESS THAN MAXVALUE); INSERT INTO t1 VALUES(-2147483648); INSERT INTO t1 VALUES(0); INSERT INTO t1 VALUES(256); INSERT INTO t1 VALUES(2147483647); DROP TABLE t1; # Exceed min limits --error ER_LIMITED_PART_RANGE CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB PARTITION BY RANGE(id) (PARTITION p1 VALUES LESS THAN (-2147483649), PARTITION p2 VALUES LESS THAN MAXVALUE); # Exceed max limits --error ER_LIMITED_PART_RANGE CREATE TABLE t1 ( id INT PRIMARY KEY) ENGINE=NDB PARTITION BY RANGE(id) (PARTITION p1 VALUES LESS THAN (2147483647), PARTITION p2 VALUES LESS THAN MAXVALUE);