mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-28 17:15:19 +03:00 
			
		
		
		
	into mysql.com:/home/gluh/MySQL/Merge/5.1-opt BitKeeper/etc/ignore: auto-union client/mysql.cc: Auto merged client/mysqltest.c: Auto merged include/mysql_com.h: Auto merged libmysql/CMakeLists.txt: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/r/archive.result: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/delayed.result: Auto merged mysql-test/r/func_misc.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/suite/rpl/r/rpl_innodb_bug28430.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/func_misc.test: Auto merged mysql-test/t/information_schema.test: Auto merged mysql-test/t/merge.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/type_date.test: Auto merged mysql-test/t/type_datetime.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/queues.c: Auto merged sql/events.cc: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_partition.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/protocol.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_open.c: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/lib/mtr_report.pl: manual merge mysql-test/r/myisam.result: manual merge mysql-test/r/partition.result: manual merge mysql-test/r/user_var.result: manual merge mysql-test/t/myisam.test: manual merge mysql-test/t/partition.test: manual merge mysql-test/t/user_var.test: manual merge sql/item.h: manual merge sql/item_func.cc: manual merge storage/myisammrg/ha_myisammrg.cc: manual merge
		
			
				
	
	
		
			1663 lines
		
	
	
		
			40 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			1663 lines
		
	
	
		
			40 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #--disable_abort_on_error
 | |
| #
 | |
| # Simple test for the partition storage engine
 | |
| # taken from the select test.
 | |
| #
 | |
| # Last update:
 | |
| # 2007-10-22 mleich  - Move ARCHIVE, BLACKHOLE and CSV related sub tests to
 | |
| #                      new tests. Reason: All these might be not available.
 | |
| #                    - Minor cleanup
 | |
| #
 | |
| --source include/have_partition.inc
 | |
| 
 | |
| --disable_warnings
 | |
| drop table if exists t1;
 | |
| --enable_warnings
 | |
| 
 | |
| #
 | |
| # Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
 | |
| #
 | |
| # To verify the fix for crashing (on unix-type OS)
 | |
| # uncomment the exec and error rows!
 | |
| 
 | |
| CREATE TABLE t1 (
 | |
|     d DATE NOT NULL
 | |
| )
 | |
| PARTITION BY RANGE( YEAR(d) ) (
 | |
|     PARTITION p0 VALUES LESS THAN (1960),
 | |
|     PARTITION p1 VALUES LESS THAN (1970),
 | |
|     PARTITION p2 VALUES LESS THAN (1980),
 | |
|     PARTITION p3 VALUES LESS THAN (1990)
 | |
| );
 | |
| 
 | |
| ALTER TABLE t1 ADD PARTITION (
 | |
| PARTITION `p5` VALUES LESS THAN (2010)
 | |
| COMMENT 'APSTART \' APEND'
 | |
| );
 | |
| #--exec sed 's/APSTART \\/APSTART  /' var/master-data/test/t1.frm > tmpt1.frm && mv tmpt1.frm var/master-data/test/t1.frm
 | |
| #--error 1064
 | |
| SELECT * FROM t1 LIMIT 1;
 | |
| 
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # Bug 30878: crashing when alter an auto_increment non partitioned
 | |
| #            table to partitioned
 | |
| 
 | |
| create table t1 (id int auto_increment, s1 int, primary key (id));
 | |
| 
 | |
| insert into t1 values (null,1);
 | |
| insert into t1 values (null,6);
 | |
| 
 | |
| select * from t1;
 | |
| 
 | |
| alter table t1 partition by range (id) (
 | |
|   partition p0 values less than (3),
 | |
|   partition p1 values less than maxvalue
 | |
| );
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug 15890: Strange number of partitions accepted
 | |
| #
 | |
| -- error ER_PARSE_ERROR
 | |
| create table t1 (a int)
 | |
| partition by key(a)
 | |
| partitions 0.2+e1;
 | |
| -- error ER_PARSE_ERROR
 | |
| create table t1 (a int)
 | |
| partition by key(a)
 | |
| partitions -1;
 | |
| -- error ER_PARSE_ERROR
 | |
| create table t1 (a int)
 | |
| partition by key(a)
 | |
| partitions 1.5;
 | |
| -- error ER_PARSE_ERROR
 | |
| create table t1 (a int)
 | |
| partition by key(a)
 | |
| partitions 1e+300;
 | |
| 
 | |
| #
 | |
| # Bug 21350: Data Directory problems
 | |
| #
 | |
| -- error ER_WRONG_TABLE_NAME
 | |
| create table t1 (a int)
 | |
| partition by key (a)
 | |
| (partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
 | |
| 
 | |
| #
 | |
| # Insert a test that manages to create the first partition and fails with
 | |
| # the second, ensure that we clean up afterwards in a proper manner.
 | |
| #
 | |
| --error ER_WRONG_TABLE_NAME
 | |
| create table t1 (a int)
 | |
| partition by key (a)
 | |
| (partition p0,
 | |
|  partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
 | |
| 
 | |
| #
 | |
| # Bug 19309 Partitions: Crash if double procedural alter
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition p0 values in (1));
 | |
| 
 | |
| create procedure pz()
 | |
| alter table t1 engine = myisam;
 | |
| 
 | |
| call pz();
 | |
| call pz();
 | |
| drop procedure pz;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 16002: Handle unsigned integer functions properly
 | |
| #
 | |
| --error ER_PARSE_ERROR
 | |
| create table t1 (a bigint)
 | |
| partition by range (a)
 | |
| (partition p0 values less than (0xFFFFFFFFFFFFFFFF),
 | |
|  partition p1 values less than (10));
 | |
| --error ER_PARSE_ERROR
 | |
| create table t1 (a bigint)
 | |
| partition by list (a)
 | |
| (partition p0 values in (0xFFFFFFFFFFFFFFFF),
 | |
|  partition p1 values in (10));
 | |
| 
 | |
| create table t1 (a bigint unsigned)
 | |
| partition by range (a)
 | |
| (partition p0 values less than (100),
 | |
|  partition p1 values less than MAXVALUE);
 | |
| insert into t1 values (1);
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (a bigint unsigned)
 | |
| partition by hash (a);
 | |
| insert into t1 values (0xFFFFFFFFFFFFFFFD);
 | |
| insert into t1 values (0xFFFFFFFFFFFFFFFE);
 | |
| select * from t1 where (a + 1) < 10;
 | |
| select * from t1 where (a + 1) > 10;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Added test case
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by key(a)
 | |
| (partition p0 engine = MEMORY);
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 19067 ALTER TABLE .. ADD PARTITION for subpartitioned table crashes
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by range (a)
 | |
| subpartition by key (a)
 | |
| (partition p0 values less than (1));
 | |
| alter table t1 add partition (partition p1 values less than (2));
 | |
| show create table t1;
 | |
| alter table t1 reorganize partition p1 into (partition p1 values less than (3));
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Partition by key no partition defined => OK
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by key (a);
 | |
| 
 | |
| #
 | |
| # Bug 13323: Select count(*) on empty table returns 2
 | |
| #
 | |
| select count(*) from t1;
 | |
| 
 | |
| #
 | |
| # Test SHOW CREATE TABLE
 | |
| #
 | |
| show create table t1;
 | |
| 
 | |
| drop table t1;
 | |
| #
 | |
| # Partition by key no partition, list of fields
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by key (a, b);
 | |
| 
 | |
| drop table t1;
 | |
| #
 | |
| # Partition by key specified 3 partitions and defined 3 => ok
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by key (a)
 | |
| partitions 3
 | |
| (partition x1, partition x2, partition x3);
 | |
| 
 | |
| drop table t1;
 | |
| #
 | |
| # Partition by key specifying nodegroup
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by key (a)
 | |
| partitions 3
 | |
| (partition x1 nodegroup 0,
 | |
|  partition x2 nodegroup 1,
 | |
|  partition x3 nodegroup 2);
 | |
| 
 | |
| drop table t1;
 | |
| #
 | |
| # Partition by key specifying engine
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by key (a)
 | |
| partitions 3
 | |
| (partition x1 engine myisam,
 | |
|  partition x2 engine myisam,
 | |
|  partition x3 engine myisam);
 | |
| 
 | |
| drop table t1;
 | |
| #
 | |
| # Partition by key specifying tablespace
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by key (a)
 | |
| partitions 3
 | |
| (partition x1 tablespace ts1,
 | |
|  partition x2 tablespace ts2,
 | |
|  partition x3 tablespace ts3);
 | |
| 
 | |
| CREATE TABLE t2 LIKE t1;
 | |
| 
 | |
| drop table t2;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Partition by key list, basic
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by list (a)
 | |
| partitions 3
 | |
| (partition x1 values in (1,2,9,4) tablespace ts1,
 | |
|  partition x2 values in (3, 11, 5, 7) tablespace ts2,
 | |
|  partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
 | |
| 
 | |
| drop table t1;
 | |
| #
 | |
| # Partition by key list, list function
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by list (b*a)
 | |
| partitions 3
 | |
| (partition x1 values in (1,2,9,4) tablespace ts1,
 | |
|  partition x2 values in (3, 11, 5, 7) tablespace ts2,
 | |
|  partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Partition by key list, list function, no spec of #partitions
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null,
 | |
| b int not null,
 | |
| c int not null,
 | |
| primary key(a,b))
 | |
| partition by list (b*a)
 | |
| (partition x1 values in (1) tablespace ts1,
 | |
|  partition x2 values in (3, 11, 5, 7) tablespace ts2,
 | |
|  partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug 13154: Insert crashes due to bad calculation of partition id
 | |
| #            for PARTITION BY KEY and SUBPARTITION BY KEY
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
| a int not null)
 | |
| partition by key(a);
 | |
| 
 | |
| LOCK TABLES t1 WRITE;
 | |
| insert into t1 values (1);
 | |
| insert into t1 values (2);
 | |
| insert into t1 values (3);
 | |
| insert into t1 values (4);
 | |
| UNLOCK TABLES;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #13644 DROP PARTITION NULL's DATE column
 | |
| #
 | |
| CREATE TABLE t1 (a int, name VARCHAR(50), purchased DATE)
 | |
| PARTITION BY RANGE (a)
 | |
| (PARTITION p0 VALUES LESS THAN (3),
 | |
|  PARTITION p1 VALUES LESS THAN (7),
 | |
|  PARTITION p2 VALUES LESS THAN (9),
 | |
|  PARTITION p3 VALUES LESS THAN (11));
 | |
| INSERT INTO t1 VALUES
 | |
| (1, 'desk organiser', '2003-10-15'),
 | |
| (2, 'CD player', '1993-11-05'),
 | |
| (3, 'TV set', '1996-03-10'),
 | |
| (4, 'bookcase', '1982-01-10'),
 | |
| (5, 'exercise bike', '2004-05-09'),
 | |
| (6, 'sofa', '1987-06-05'),
 | |
| (7, 'popcorn maker', '2001-11-22'),
 | |
| (8, 'acquarium', '1992-08-04'),
 | |
| (9, 'study desk', '1984-09-16'),
 | |
| (10, 'lava lamp', '1998-12-25');
 | |
| 
 | |
| SELECT * from t1 ORDER BY a;
 | |
| ALTER TABLE t1 DROP PARTITION p0;
 | |
| SELECT * from t1 ORDER BY a;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #13442; Truncate Partitioned table doesn't work
 | |
| #
 | |
| 
 | |
| CREATE TABLE t1 (a int)
 | |
| PARTITION BY LIST (a)
 | |
| (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4,5,6));
 | |
| 
 | |
| insert into t1 values (1),(2),(3),(4),(5),(6);
 | |
| select * from t1;
 | |
| truncate t1;
 | |
| select * from t1;
 | |
| truncate t1;
 | |
| select * from t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #13445 Partition by KEY method crashes server
 | |
| #
 | |
| CREATE TABLE t1 (a int, b int, primary key(a,b))
 | |
| PARTITION BY KEY(b,a) PARTITIONS 4;
 | |
| 
 | |
| insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
 | |
| select * from t1 where a = 4;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug#22351 - handler::index_next_same() call to key_cmp_if_same()
 | |
| #             uses the wrong buffer
 | |
| #
 | |
| CREATE TABLE t1 (c1 INT, c2 INT, PRIMARY KEY USING BTREE (c1,c2)) ENGINE=MEMORY
 | |
|   PARTITION BY KEY(c2,c1) PARTITIONS 4;
 | |
| INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
 | |
| SELECT * FROM t1 WHERE c1 = 4;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # Bug #13438: Engine clause in PARTITION clause causes crash
 | |
| #
 | |
| CREATE TABLE t1 (a int)
 | |
| PARTITION BY LIST (a)
 | |
| PARTITIONS 1
 | |
| (PARTITION x1 VALUES IN (1) ENGINE=MEMORY);
 | |
| 
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #13440: REPLACE causes crash in partitioned table
 | |
| #
 | |
| CREATE TABLE t1 (a int, unique(a))
 | |
| PARTITION BY LIST (a)
 | |
| (PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
 | |
| 
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE 
 | |
| REPLACE t1 SET a = 4;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #14365: Crash if value too small in list partitioned table
 | |
| #
 | |
| CREATE TABLE t1 (a int)
 | |
| PARTITION BY LIST (a)
 | |
| (PARTITION x1 VALUES IN (2), PARTITION x2 VALUES IN (3));
 | |
| 
 | |
| insert into t1 values (2), (3);
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE
 | |
| insert into t1 values (4);
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE
 | |
| insert into t1 values (1);
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug 14327: PARTITIONS clause gets lost in SHOW CREATE TABLE
 | |
| #
 | |
| CREATE TABLE t1 (a int)
 | |
| PARTITION BY HASH(a)
 | |
| PARTITIONS 5;
 | |
| 
 | |
| SHOW CREATE TABLE t1;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #13446: Update to value outside of list values doesn't give error
 | |
| #
 | |
| CREATE TABLE t1 (a int)
 | |
| PARTITION BY RANGE (a)
 | |
| (PARTITION x1 VALUES LESS THAN (2));
 | |
| 
 | |
| insert into t1 values (1);
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE
 | |
| update t1 set a = 5;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #13441: Analyze on partitioned table didn't work
 | |
| #
 | |
| CREATE TABLE t1 (a int)
 | |
| PARTITION BY LIST (a)
 | |
| (PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
 | |
| 
 | |
| analyze table t1;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 15221 (Cannot reorganize with the same name)
 | |
| #
 | |
| create table t1
 | |
| (a int)
 | |
| partition by range (a)
 | |
|   ( partition p0 values less than(10),
 | |
|     partition p1 values less than (20),
 | |
|     partition p2 values less than (25));
 | |
| 
 | |
| alter table t1 reorganize partition p2 into (partition p2 values less than (30));
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| 
 | |
| CREATE TABLE t1 (a int, b int)
 | |
| PARTITION BY RANGE (a)
 | |
| (PARTITION x0 VALUES LESS THAN (2),
 | |
|  PARTITION x1 VALUES LESS THAN (4),
 | |
|  PARTITION x2 VALUES LESS THAN (6),
 | |
|  PARTITION x3 VALUES LESS THAN (8),
 | |
|  PARTITION x4 VALUES LESS THAN (10),
 | |
|  PARTITION x5 VALUES LESS THAN (12),
 | |
|  PARTITION x6 VALUES LESS THAN (14),
 | |
|  PARTITION x7 VALUES LESS THAN (16),
 | |
|  PARTITION x8 VALUES LESS THAN (18),
 | |
|  PARTITION x9 VALUES LESS THAN (20));
 | |
| 
 | |
| ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
 | |
| (PARTITION x1 VALUES LESS THAN (6));
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| 
 | |
| # Testcase for BUG#15819
 | |
| create table t1 (a int not null, b int not null) partition by LIST (a+b) (
 | |
|   partition p0 values in (12),
 | |
|   partition p1 values in (14)
 | |
| );
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE
 | |
| insert into t1 values (10,1);
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug#16901 Partitions: crash, SELECT, column of part.
 | |
| #           function=first column of primary key
 | |
| #
 | |
| create table t1 (f1 integer,f2 integer, f3 varchar(10), primary key(f1,f2))
 | |
| partition by range(f1) subpartition by hash(f2) subpartitions 2
 | |
| (partition p1 values less than (0),
 | |
|  partition p2 values less than (2),
 | |
|  partition p3 values less than (2147483647));
 | |
| 
 | |
| insert into t1 values(10,10,'10');
 | |
| insert into t1 values(2,2,'2');
 | |
| select * from t1 where f1 = 2;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #16907 Partitions: crash, SELECT goes into last partition, UNIQUE INDEX
 | |
| #
 | |
| create table t1 (f1 integer,f2 integer, unique index(f1))
 | |
| partition by range(f1 div 2)
 | |
| subpartition by hash(f1) subpartitions 2
 | |
| (partition partb values less than (2),
 | |
| partition parte values less than (4),
 | |
| partition partf values less than (10000));
 | |
| insert into t1 values(10,1);
 | |
| select * from t1 where f1 = 10;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #16775: Wrong engine type stored for subpartition
 | |
| #
 | |
| set session storage_engine= 'memory';
 | |
| create table t1 (f_int1 int(11) default null) engine = memory
 | |
|   partition by range (f_int1) subpartition by hash (f_int1)
 | |
|   (partition part1 values less than (1000)
 | |
|    (subpartition subpart11 engine = memory));
 | |
| drop table t1;
 | |
| set session storage_engine='myisam';
 | |
| 
 | |
| #
 | |
| # Bug #16782: Crash using REPLACE on table with primary key
 | |
| #
 | |
| create table t1 (f_int1 integer, f_int2 integer, primary key (f_int1))
 | |
|   partition by hash(f_int1) partitions 2;
 | |
| insert into t1 values (1,1),(2,2);
 | |
| replace into t1 values (1,1),(2,2);
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #17169: Partitions: out of memory if add partition and unique
 | |
| #
 | |
| create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUES in (10), partition x2 values in (20));
 | |
| alter table t1 add partition (partition x3 values in (30));
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #17754 Change to explicit removal of partitioning scheme
 | |
| # Also added a number of tests to ensure that proper engine is
 | |
| # choosen in all kinds of scenarios.
 | |
| #
 | |
| 
 | |
| create table t1 (a int)
 | |
| partition by key(a)
 | |
| partitions 2
 | |
| (partition p0 engine=myisam, partition p1 engine=myisam);
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1;
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1 engine=myisam;
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1 engine=heap;
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1 remove partitioning;
 | |
| show create table t1;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (a int)
 | |
| engine=myisam
 | |
| partition by key(a)
 | |
| partitions 2
 | |
| (partition p0 engine=myisam, partition p1 engine=myisam);
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1 add column b int remove partitioning;
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1
 | |
| engine=myisam
 | |
| partition by key(a)
 | |
| (partition p0 engine=myisam, partition p1);
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1
 | |
| engine=heap
 | |
| partition by key(a)
 | |
| (partition p0, partition p1 engine=heap);
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1 engine=myisam, add column c int remove partitioning;
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1
 | |
| engine=heap
 | |
| partition by key (a)
 | |
| (partition p0, partition p1);
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1
 | |
| partition by key (a)
 | |
| (partition p0, partition p1);
 | |
| show create table t1;
 | |
| 
 | |
| alter table t1
 | |
| engine=heap
 | |
| partition by key (a)
 | |
| (partition p0, partition p1);
 | |
| show create table t1;
 | |
| 
 | |
| --error ER_MIX_HANDLER_ERROR
 | |
| alter table t1
 | |
| partition by key(a)
 | |
| (partition p0, partition p1 engine=heap);
 | |
| 
 | |
| --error ER_MIX_HANDLER_ERROR
 | |
| alter table t1
 | |
| partition by key(a)
 | |
| (partition p0 engine=heap, partition p1);
 | |
| 
 | |
| --error ER_MIX_HANDLER_ERROR
 | |
| alter table t1
 | |
| engine=heap
 | |
| partition by key (a)
 | |
| (partition p0 engine=heap, partition p1 engine=myisam);
 | |
| 
 | |
| --error ER_MIX_HANDLER_ERROR
 | |
| alter table t1
 | |
| partition by key (a)
 | |
| (partition p0 engine=heap, partition p1 engine=myisam);
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| # Bug #17432: Partition functions containing NULL values should return
 | |
| #             LONGLONG_MIN
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
|  f_int1 INTEGER, f_int2 INTEGER,
 | |
|  f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000)
 | |
|  )
 | |
|  PARTITION BY RANGE(f_int1 DIV 2)
 | |
|  SUBPARTITION BY HASH(f_int1)
 | |
|  SUBPARTITIONS 2
 | |
|  (PARTITION parta VALUES LESS THAN (0),
 | |
|   PARTITION partb VALUES LESS THAN (5),
 | |
|   PARTITION parte VALUES LESS THAN (10),
 | |
|   PARTITION partf VALUES LESS THAN (2147483647));
 | |
| INSERT INTO t1 SET f_int1 = NULL , f_int2 = -20, f_char1 = CAST(-20 AS CHAR),
 | |
|                    f_char2 = CAST(-20 AS CHAR), f_charbig = '#NULL#';
 | |
| SELECT * FROM t1 WHERE f_int1 IS NULL;
 | |
| SELECT * FROM t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug 17430: Crash when SELECT * from t1 where field IS NULL
 | |
| #
 | |
| 
 | |
| CREATE TABLE t1 (
 | |
|  f_int1 INTEGER, f_int2 INTEGER,
 | |
|  f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000)  )
 | |
|  PARTITION BY LIST(MOD(f_int1,2))
 | |
|  SUBPARTITION BY KEY(f_int1)
 | |
|  (PARTITION part1 VALUES IN (-1) (SUBPARTITION sp1, SUBPARTITION sp2),
 | |
|   PARTITION part2 VALUES IN (0) (SUBPARTITION sp3, SUBPARTITION sp5),
 | |
|   PARTITION part3 VALUES IN (1) (SUBPARTITION sp4, SUBPARTITION sp6));
 | |
| 
 | |
| INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2===';
 | |
| INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2===';
 | |
| 
 | |
| SELECT * FROM t1 WHERE f_int1  IS NULL;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug#14363 Partitions: failure if create in stored procedure
 | |
| #
 | |
| delimiter //;
 | |
| 
 | |
| create procedure p ()
 | |
| begin
 | |
| create table t1 (s1 mediumint,s2 mediumint)
 | |
| partition by list (s2)
 | |
| (partition p1 values in (0),
 | |
|  partition p2 values in (1));
 | |
| end//
 | |
| 
 | |
| call p()//
 | |
| drop procedure p//
 | |
| drop table t1;
 | |
| 
 | |
| create procedure p ()
 | |
| begin
 | |
| create table t1 (a int not null,b int not null,c int not null,primary key (a,b))
 | |
| partition by range (a)
 | |
| subpartition by hash (a+b)
 | |
| (partition x1 values less than (1)
 | |
|  (subpartition x11,
 | |
|   subpartition x12),
 | |
|  partition x2 values less than (5)
 | |
|  (subpartition x21,
 | |
|   subpartition x22));
 | |
| end//
 | |
| 
 | |
| call p()//
 | |
| drop procedure p//
 | |
| drop table t1//
 | |
| delimiter ;//
 | |
| 
 | |
| #
 | |
| # Bug #15447  Partitions: NULL is treated as zero
 | |
| #
 | |
| 
 | |
| # NULL for RANGE partition
 | |
| create table t1 (a int,b int,c int,key(a,b))
 | |
| partition by range (a)
 | |
| partitions 3
 | |
| (partition x1 values less than (0) tablespace ts1,
 | |
|  partition x2 values less than (10) tablespace ts2,
 | |
|  partition x3 values less than maxvalue tablespace ts3);
 | |
| 
 | |
| insert into t1 values (NULL, 1, 1);
 | |
| insert into t1 values (0, 1, 1);
 | |
| insert into t1 values (12, 1, 1);
 | |
| 
 | |
| select partition_name, partition_description, table_rows
 | |
| from information_schema.partitions where table_schema ='test';
 | |
| drop table t1;
 | |
| 
 | |
| # NULL for LIST partition
 | |
| --error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
 | |
| create table t1 (a int,b int, c int)
 | |
| partition by list(a)
 | |
| partitions 2
 | |
| (partition x123 values in (11,12),
 | |
|  partition x234 values in (1 ,NULL, NULL));
 | |
| 
 | |
| --error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
 | |
| create table t1 (a int,b int, c int)
 | |
| partition by list(a)
 | |
| partitions 2
 | |
| (partition x123 values in (11, NULL),
 | |
|  partition x234 values in (1 ,NULL));
 | |
| 
 | |
| create table t1 (a int,b int, c int)
 | |
| partition by list(a)
 | |
| partitions 2
 | |
| (partition x123 values in (11, 12),
 | |
|  partition x234 values in (5, 1));
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE
 | |
| insert into t1 values (NULL,1,1);
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (a int,b int, c int)
 | |
| partition by list(a)
 | |
| partitions 2
 | |
| (partition x123 values in (11, 12),
 | |
|  partition x234 values in (NULL, 1));
 | |
| 
 | |
| insert into t1 values (11,1,6);
 | |
| insert into t1 values (NULL,1,1);
 | |
| 
 | |
| select partition_name, partition_description, table_rows
 | |
| from information_schema.partitions where table_schema ='test';
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 17947 Crash with REBUILD PARTITION
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition p0 values in (1));
 | |
| 
 | |
| --error ER_PARSE_ERROR
 | |
| alter table t1 rebuild partition;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 15253 Insert that should fail doesn't
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition p0 values in (5));
 | |
| 
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE
 | |
| insert into t1 values (0);
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG #16370 Subpartitions names not shown in SHOW CREATE TABLE output
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by range (a) subpartition by hash (a)
 | |
| (partition p0 values less than (100));
 | |
| 
 | |
| show create table t1;
 | |
| alter table t1 add partition (partition p1 values less than (200)
 | |
| (subpartition subpart21));
 | |
| 
 | |
| show create table t1;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (a int)
 | |
| partition by key (a);
 | |
| 
 | |
| show create table t1;
 | |
| alter table t1 add partition (partition p1);
 | |
| show create table t1;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 15407 Crash with subpartition
 | |
| #
 | |
| --error ER_PARSE_ERROR
 | |
| create table t1 (a int, b int)
 | |
| partition by range (a)
 | |
| subpartition by hash(a)
 | |
| (partition p0 values less than (0) (subpartition sp0),
 | |
|  partition p1 values less than (1));
 | |
| 
 | |
| --error ER_PARSE_ERROR
 | |
| create table t1 (a int, b int)
 | |
| partition by range (a)
 | |
| subpartition by hash(a)
 | |
| (partition p0 values less than (0),
 | |
|  partition p1 values less than (1) (subpartition sp0));
 | |
| 
 | |
| #
 | |
| # BUG 15961 No error when subpartition defined without subpartition by clause
 | |
| #
 | |
| --error ER_SUBPARTITION_ERROR
 | |
| create table t1 (a int)
 | |
| partition by hash (a)
 | |
| (partition p0 (subpartition sp0));
 | |
| 
 | |
| #
 | |
| # Bug 17127 
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by range (a)
 | |
| (partition p0 values less than (1));
 | |
| 
 | |
| --error ER_PARTITION_WRONG_VALUES_ERROR
 | |
| alter table t1 add partition (partition p1 values in (2));
 | |
| --error ER_PARTITION_REQUIRES_VALUES_ERROR
 | |
| alter table t1 add partition (partition p1);
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition p0 values in (1));
 | |
| 
 | |
| --error ER_PARTITION_WRONG_VALUES_ERROR
 | |
| alter table t1 add partition (partition p1 values less than (2));
 | |
| --error ER_PARTITION_REQUIRES_VALUES_ERROR
 | |
| alter table t1 add partition (partition p1);
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (a int)
 | |
| partition by hash (a)
 | |
| (partition p0);
 | |
| 
 | |
| --error ER_PARTITION_WRONG_VALUES_ERROR
 | |
| alter table t1 add partition (partition p1 values less than (2));
 | |
| --error ER_PARTITION_WRONG_VALUES_ERROR
 | |
| alter table t1 add partition (partition p1 values in (2));
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 17947 Crash with REBUILD PARTITION
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition p0 values in (1));
 | |
| 
 | |
| --error ER_PARSE_ERROR
 | |
| alter table t1 rebuild partition;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #14526: Partitions: indexed searches fail
 | |
| #
 | |
| create table t2 (s1 int not null auto_increment, primary key (s1)) partition by list (s1) (partition p1 values in (1),partition p2 values in (2),partition p3 values in (3),partition p4 values in (4));
 | |
| insert into t2 values (null),(null),(null);
 | |
| select * from t2;
 | |
| select * from t2 where s1 < 2;
 | |
| update t2 set s1 = s1 + 1 order by s1 desc;
 | |
| select * from t2 where s1 < 3;
 | |
| select * from t2 where s1 = 2;
 | |
| drop table t2;
 | |
| 
 | |
| #
 | |
| # Bug #17497: Partitions: crash if add partition on temporary table
 | |
| #
 | |
| --error ER_PARTITION_NO_TEMPORARY
 | |
| create temporary table t1 (a int) partition by hash(a);
 | |
| 
 | |
| #
 | |
| # Bug #17097: Partitions: failing ADD PRIMARY KEY leads to temporary rotten
 | |
| # metadata,crash
 | |
| #
 | |
| create table t1 (a int, b int) partition by list (a)
 | |
|   (partition p1 values in (1), partition p2 values in (2));
 | |
| --error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
 | |
| alter table t1 add primary key (b);
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| 
 | |
| ############################################
 | |
| #
 | |
| # Author: Mikael Ronstrom
 | |
| # Date:   2006-03-01
 | |
| # Purpose
 | |
| # Bug 17772: Crash at ALTER TABLE with rename
 | |
| #            and add column + comment on
 | |
| #            partitioned table
 | |
| #
 | |
| ############################################
 | |
| create table t1 (a int unsigned not null auto_increment primary key)
 | |
| partition by key(a);
 | |
| alter table t1 rename t2, add c char(10), comment "no comment";
 | |
| show create table t2;
 | |
| 
 | |
| drop table t2;
 | |
| 
 | |
| #
 | |
| # Bug#15336 Partitions: crash if create table as select
 | |
| #
 | |
| create table t1 (f1 int) partition by hash (f1) as select 1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # bug #14350 Partitions: crash if prepared statement
 | |
| #
 | |
| prepare stmt1 from 'create table t1 (s1 int) partition by hash (s1)';
 | |
| execute stmt1;
 | |
| --error ER_TABLE_EXISTS_ERROR
 | |
| execute stmt1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # bug 17290 SP with delete, create and rollback to save point causes MySQLD core
 | |
| #
 | |
| delimiter |;
 | |
| eval CREATE PROCEDURE test.p1(IN i INT)
 | |
| BEGIN
 | |
|   DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
 | |
|   DROP TABLE IF EXISTS t1;
 | |
|   CREATE TABLE t1 (num INT,PRIMARY KEY(num));
 | |
|   START TRANSACTION;
 | |
|     INSERT INTO t1 VALUES(i);
 | |
|     savepoint t1_save;
 | |
|     INSERT INTO t1 VALUES (14);
 | |
|     ROLLBACK to savepoint t1_save;
 | |
|     COMMIT;
 | |
| END|
 | |
| delimiter ;|
 | |
| CALL test.p1(12);
 | |
| CALL test.p1(13);
 | |
| drop table t1;
 | |
| drop procedure test.p1;
 | |
| 
 | |
| #
 | |
| # Bug 13520: Problem with delimiters in COMMENT DATA DIRECTORY ..
 | |
| #
 | |
| CREATE TABLE t1 (a int not null)
 | |
| partition by key(a)
 | |
| (partition p0 COMMENT='first partition');
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug 13433: Problem with delimited identifiers
 | |
| #
 | |
| CREATE TABLE t1 (`a b` int not null)
 | |
| partition by key(`a b`);
 | |
| drop table t1;
 | |
| 
 | |
| CREATE TABLE t1 (`a b` int not null)
 | |
| partition by hash(`a b`);
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug#18053 Partitions: crash if null
 | |
| # Bug#18070 Partitions: wrong result on WHERE ... IS NULL
 | |
| #
 | |
| create table t1 (f1 integer) partition by range(f1)
 | |
| (partition p1 values less than (0), partition p2 values less than (10));
 | |
| insert into t1 set f1 = null;
 | |
| select * from t1 where f1 is null;
 | |
| explain partitions select * from t1 where f1 is null;
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (f1 integer) partition by list(f1)
 | |
| (partition p1 values in (1), partition p2 values in (null));
 | |
| insert into t1 set f1 = null;
 | |
| insert into t1 set f1 = 1;
 | |
| select * from t1 where f1 is null or f1 = 1;
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (f1 smallint)
 | |
| partition by list (f1) (partition p0 values in (null));
 | |
| insert into t1 values (null);
 | |
| select * from t1 where f1 is null;
 | |
| select * from t1 where f1 < 1;
 | |
| select * from t1 where f1 <= NULL;
 | |
| select * from t1 where f1 < NULL;
 | |
| select * from t1 where f1 >= NULL;
 | |
| select * from t1 where f1 > NULL;
 | |
| select * from t1 where f1 > 1;
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (f1 smallint)
 | |
| partition by range (f1) (partition p0 values less than (0));
 | |
| insert into t1 values (null);
 | |
| select * from t1 where f1 is null;
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (f1 integer) partition by list(f1)
 | |
| (
 | |
|  partition p1 values in (1),
 | |
|  partition p2 values in (NULL),
 | |
|  partition p3 values in (2),
 | |
|  partition p4 values in (3),
 | |
|  partition p5 values in (4)
 | |
| );
 | |
| 
 | |
| insert into t1 values (1),(2),(3),(4),(null);
 | |
| select * from t1 where f1 < 3;
 | |
| explain partitions select * from t1 where f1 < 3;
 | |
| select * from t1 where f1 is null;
 | |
| explain partitions select * from t1 where f1 is null;
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (f1 int) partition by list(f1 div 2)
 | |
| (
 | |
|  partition p1 values in (1),
 | |
|  partition p2 values in (NULL),
 | |
|  partition p3 values in (2),
 | |
|  partition p4 values in (3),
 | |
|  partition p5 values in (4)
 | |
| );
 | |
| 
 | |
| insert into t1 values (2),(4),(6),(8),(null);
 | |
| select * from t1 where f1 < 3;
 | |
| explain partitions select * from t1 where f1 < 3;
 | |
| select * from t1 where f1 is null;
 | |
| explain partitions select * from t1 where f1 is null;
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (a int) partition by LIST(a) (
 | |
|   partition pn values in (NULL),
 | |
|   partition p0 values in (0),
 | |
|   partition p1 values in (1),
 | |
|   partition p2 values in (2)
 | |
| );
 | |
| insert into t1 values (NULL),(0),(1),(2);
 | |
| select * from t1 where a is null or a < 2;
 | |
| explain partitions select * from t1 where a is null or a < 2;
 | |
| select * from t1 where a is null or a < 0 or a > 1;
 | |
| explain partitions select * from t1 where a is null or a < 0 or a > 1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| #Bug# 17631 SHOW TABLE STATUS reports wrong engine
 | |
| #
 | |
| CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20)) 
 | |
| ENGINE=MyISAM DEFAULT CHARSET=latin1
 | |
| PARTITION BY RANGE(id)
 | |
| (PARTITION p0  VALUES LESS THAN (10) ENGINE = MyISAM,
 | |
| PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM,
 | |
| PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM);
 | |
| --replace_column 6 0 7 0 8 0 9 0 12 NULL 13 NULL 14 NULL
 | |
| SHOW TABLE STATUS;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| #BUG 16002 Erroneus handling of unsigned partition functions
 | |
| #
 | |
| --error ER_PARTITION_CONST_DOMAIN_ERROR
 | |
| create table t1 (a bigint unsigned)
 | |
| partition by list (a)
 | |
| (partition p0 values in (0-1));
 | |
| 
 | |
| create table t1 (a bigint unsigned)
 | |
| partition by range (a)
 | |
| (partition p0 values less than (10));
 | |
| 
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE
 | |
| insert into t1 values (0xFFFFFFFFFFFFFFFF);
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| #BUG 18750 Problems with partition names
 | |
| #
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition `s1 s2` values in (0));
 | |
| drop table t1;
 | |
| 
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition `7` values in (0));
 | |
| drop table t1;
 | |
| 
 | |
| --error ER_WRONG_PARTITION_NAME
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition `s1 s2 ` values in (0));
 | |
| 
 | |
| --error ER_WRONG_PARTITION_NAME
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| subpartition by hash (a)
 | |
| (partition p1 values in (0) (subpartition `p1 p2 `));
 | |
| 
 | |
| #
 | |
| # BUG 18752 SHOW CREATE TABLE doesn't show NULL value in SHOW CREATE TABLE
 | |
| #
 | |
| CREATE TABLE t1 (a int)
 | |
| PARTITION BY LIST (a)
 | |
| (PARTITION p0 VALUES IN (NULL));
 | |
| SHOW CREATE TABLE t1;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| --error ER_PARSE_ERROR
 | |
| CREATE TABLE t1 (a int)
 | |
| PARTITION BY RANGE(a)
 | |
| (PARTITION p0 VALUES LESS THAN (NULL));
 | |
| 
 | |
| #
 | |
| # Bug#18753 Partitions: auto_increment fails
 | |
| #
 | |
| create table t1 (s1 int auto_increment primary key)
 | |
| partition by list (s1)
 | |
| (partition p1 values in (1),
 | |
|  partition p2 values in (2),
 | |
|  partition p3 values in (3));
 | |
| insert into t1 values (null);
 | |
| insert into t1 values (null);
 | |
| insert into t1 values (null);
 | |
| select auto_increment from information_schema.tables where table_name='t1';
 | |
| select * from t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 19140 Partitions: Create index for partitioned table crashes
 | |
| #
 | |
| create table t1 (a int) engine=memory
 | |
| partition by key(a);
 | |
| insert into t1 values (1);
 | |
| create index inx1 on t1(a);
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug 19695 Partitions: SHOW CREATE TABLE shows table options even when it
 | |
| #                       shouldn't
 | |
| #
 | |
| create table t1 (a int)
 | |
| PARTITION BY KEY (a)
 | |
| (PARTITION p0);
 | |
| set session sql_mode='no_table_options';
 | |
| show create table t1;
 | |
| set session sql_mode='';
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 19304 Partitions: MERGE handler not allowed in partitioned tables
 | |
| #
 | |
| --error ER_PARTITION_MERGE_ERROR
 | |
| create table t1 (a int)
 | |
| partition by key (a)
 | |
| (partition p0 engine = MERGE);
 | |
| 
 | |
| #
 | |
| # BUG 19062 Partition clause ignored if CREATE TABLE ... AS SELECT ...;
 | |
| #
 | |
| create table t1 (a varchar(1))
 | |
| partition by key (a)
 | |
| as select 'a';
 | |
| 
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG 19501 Partitions: SHOW TABLE STATUS shows wrong Data_free
 | |
| #
 | |
| CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a);
 | |
| INSERT into t1 values (1), (2);
 | |
| --replace_column 9 0 12 NULL 13 NULL 14 NULL
 | |
| SHOW TABLE STATUS;
 | |
| DELETE from t1 where a = 1;
 | |
| --replace_column 9 0 12 NULL 13 NULL 14 NULL
 | |
| SHOW TABLE STATUS;
 | |
| ALTER TABLE t1 OPTIMIZE PARTITION p0;
 | |
| --replace_column 12 NULL 13 NULL 14 NULL
 | |
| SHOW TABLE STATUS;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # BUG 19502: ENABLE/DISABLE Keys don't work for partitioned tables
 | |
| #
 | |
| CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
 | |
| ALTER TABLE t1 DISABLE KEYS;
 | |
| ALTER TABLE t1 ENABLE KEYS;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # Bug 17455 Partitions: Wrong message and error when using Repair/Optimize
 | |
| #                       table on partitioned table
 | |
| #
 | |
| create table t1 (a int)
 | |
| engine=MEMORY
 | |
| partition by key (a);
 | |
| 
 | |
| REPAIR TABLE t1;
 | |
| OPTIMIZE TABLE t1;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| #BUG 17138 Problem with stored procedure and analyze partition
 | |
| #
 | |
| --disable_warnings
 | |
| drop procedure if exists mysqltest_1;
 | |
| --enable_warnings
 | |
| 
 | |
| create table t1 (a int)
 | |
| partition by list (a)
 | |
| (partition p0 values in (0));
 | |
| 
 | |
| insert into t1 values (0);
 | |
| delimiter //;
 | |
| 
 | |
| create procedure mysqltest_1 ()
 | |
| begin
 | |
|   begin
 | |
|     declare continue handler for sqlexception begin end;
 | |
|     update ignore t1 set a = 1 where a = 0;
 | |
|   end;
 | |
|   prepare stmt1 from 'alter table t1';
 | |
|   execute stmt1;
 | |
| end//
 | |
| 
 | |
| call mysqltest_1()//
 | |
| delimiter ;//
 | |
| drop table t1;
 | |
| drop procedure mysqltest_1;
 | |
| 
 | |
| #
 | |
| # Bug 20583 Partitions: Crash using index_last
 | |
| #
 | |
| create table t1 (a int, index(a))
 | |
| partition by hash(a);
 | |
| insert into t1 values (1),(2);
 | |
| select * from t1 ORDER BY a DESC;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug 21388: Bigint fails to find record
 | |
| #
 | |
| create table t1 (a bigint unsigned not null, primary key(a))
 | |
| engine = myisam
 | |
| partition by key (a)
 | |
| partitions 10;
 | |
| 
 | |
| show create table t1;
 | |
| insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE),
 | |
| (18446744073709551613), (18446744073709551612);
 | |
| select * from t1;
 | |
| select * from t1 where a = 18446744073709551615;
 | |
| delete from t1 where a = 18446744073709551615;
 | |
| select * from t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug 24502 reorganize partition closes connection
 | |
| #
 | |
| CREATE TABLE t1 (
 | |
|   num int(11) NOT NULL, cs int(11) NOT NULL)
 | |
| PARTITION BY RANGE (num) SUBPARTITION BY HASH (
 | |
| cs) SUBPARTITIONS 2 (PARTITION p_X VALUES LESS THAN MAXVALUE);
 | |
| 
 | |
| ALTER TABLE t1 
 | |
| REORGANIZE PARTITION p_X INTO ( 
 | |
|     PARTITION p_100 VALUES LESS THAN (100), 
 | |
|     PARTITION p_X VALUES LESS THAN MAXVALUE 
 | |
|     );
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #24186 (nested query across partitions returns fewer records)
 | |
| #
 | |
| 
 | |
| CREATE TABLE t2 (
 | |
|   taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
 | |
|   id int(11) NOT NULL DEFAULT '0',
 | |
|   PRIMARY KEY (id,taken),
 | |
|   KEY taken (taken)
 | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 | |
| 
 | |
| INSERT INTO t2 VALUES 
 | |
| ('2006-09-27 21:50:01',16421),
 | |
| ('2006-10-02 21:50:01',16421),
 | |
| ('2006-09-27 21:50:01',19092),
 | |
| ('2006-09-28 21:50:01',19092),
 | |
| ('2006-09-29 21:50:01',19092),
 | |
| ('2006-09-30 21:50:01',19092),
 | |
| ('2006-10-01 21:50:01',19092),
 | |
| ('2006-10-02 21:50:01',19092),
 | |
| ('2006-09-27 21:50:01',22589),
 | |
| ('2006-09-29 21:50:01',22589);
 | |
| 
 | |
| CREATE TABLE t1 (
 | |
|   id int(8) NOT NULL,
 | |
|   PRIMARY KEY (id)
 | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 | |
| 
 | |
| INSERT INTO t1 VALUES 
 | |
| (16421),
 | |
| (19092),
 | |
| (22589);
 | |
| 
 | |
| CREATE TABLE t4 (
 | |
|   taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
 | |
|   id int(11) NOT NULL DEFAULT '0',
 | |
|   PRIMARY KEY (id,taken),
 | |
|   KEY taken (taken)
 | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1 
 | |
| PARTITION BY RANGE (to_days(taken)) 
 | |
| (
 | |
| PARTITION p01 VALUES LESS THAN (732920) , 
 | |
| PARTITION p02 VALUES LESS THAN (732950) , 
 | |
| PARTITION p03 VALUES LESS THAN MAXVALUE ) ;
 | |
| 
 | |
| INSERT INTO t4 select * from t2;
 | |
| 
 | |
| set @f_date='2006-09-28';
 | |
| set @t_date='2006-10-02';
 | |
| 
 | |
| SELECT t1.id AS MyISAM_part
 | |
| FROM t1
 | |
| WHERE t1.id IN (
 | |
|     SELECT distinct id
 | |
|     FROM t4
 | |
|     WHERE taken BETWEEN @f_date AND date_add(@t_date, INTERVAL 1 DAY))
 | |
| ORDER BY t1.id
 | |
| ;
 | |
| 
 | |
| drop table t1, t2, t4;
 | |
| 
 | |
| CREATE TABLE t1 (
 | |
|   taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
 | |
|   id int(11) NOT NULL DEFAULT '0',
 | |
|   status varchar(20) NOT NULL DEFAULT '',
 | |
|   PRIMARY KEY (id,taken)
 | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 | |
| PARTITION BY RANGE (to_days(taken))
 | |
| (
 | |
| PARTITION p15 VALUES LESS THAN (732950) ,
 | |
| PARTITION p16 VALUES LESS THAN MAXVALUE ) ;
 | |
| 
 | |
| 
 | |
| INSERT INTO t1 VALUES
 | |
| ('2006-09-27 21:50:01',22589,'Open'),
 | |
| ('2006-09-29 21:50:01',22589,'Verified');
 | |
| 
 | |
| DROP TABLE IF EXISTS t2;
 | |
| CREATE TABLE t2 (
 | |
|   id int(8) NOT NULL,
 | |
|   severity tinyint(4) NOT NULL DEFAULT '0',
 | |
|   priority tinyint(4) NOT NULL DEFAULT '0',
 | |
|   status varchar(20) DEFAULT NULL,
 | |
|   alien tinyint(4) NOT NULL
 | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 | |
| 
 | |
| INSERT INTO t2 VALUES
 | |
| (22589,1,1,'Need Feedback',0);
 | |
| 
 | |
| SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified');
 | |
| 
 | |
| drop table t1, t2;
 | |
| 
 | |
| #
 | |
| # Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables 
 | |
| #
 | |
| 
 | |
| disable_query_log;
 | |
| eval create table t2 (i int )
 | |
| partition by range (i)
 | |
| (
 | |
|     partition p01 values less than (1000)
 | |
|     data directory="$MYSQLTEST_VARDIR/master-data/test/"
 | |
|     index directory="$MYSQLTEST_VARDIR/master-data/test/"
 | |
| );
 | |
| enable_query_log;
 | |
| 
 | |
| set @org_mode=@@sql_mode;
 | |
| set @@sql_mode='NO_DIR_IN_CREATE';
 | |
| select @@sql_mode;
 | |
| create table t1 (i int )
 | |
| partition by range (i)
 | |
| (
 | |
|     partition p01 values less than (1000)
 | |
|     data directory='/not/existing'
 | |
|     index directory='/not/existing'
 | |
| );
 | |
| 
 | |
| show create table t2;
 | |
| DROP TABLE t1, t2;
 | |
| set @@sql_mode=@org_mode;
 | |
| 
 | |
| #
 | |
| # Bug #27123 partition + on duplicate key update + varchar = Can't find record in <table> 
 | |
| #
 | |
| create table t1 (c1 varchar(255),c2 tinyint,primary key(c1))
 | |
|    partition by key (c1) partitions 10 ;
 | |
| insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
 | |
| insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
 | |
| select * from t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #28005 Partitions: can't use -9223372036854775808 
 | |
| #
 | |
| 
 | |
| create table t1 (s1 bigint) partition by list (s1) (partition p1 values in (-9223372036854775808));
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
 | |
| #
 | |
| create table t1(a int auto_increment, b int, primary key (b, a)) 
 | |
|   partition by hash(b) partitions 2;
 | |
| insert into t1 values (null, 1);
 | |
| --replace_column 9 0 12 NULL 13 NULL 14 NULL
 | |
| show table status;
 | |
| drop table t1;
 | |
| 
 | |
| create table t1(a int auto_increment primary key)
 | |
|   partition by key(a) partitions 2;
 | |
| insert into t1 values (null), (null), (null);
 | |
| --replace_column 9 0 12 NULL 13 NULL 14 NULL
 | |
| show table status;
 | |
| drop table t1;
 | |
| # Bug #28488: Incorrect information in file: './test/t1_test#.frm'
 | |
| #
 | |
| 
 | |
| CREATE TABLE t1(a INT NOT NULL, b TINYBLOB, KEY(a))
 | |
|   PARTITION BY RANGE(a) ( PARTITION p0 VALUES LESS THAN (32));
 | |
| INSERT INTO t1 VALUES (1, REPEAT('a', 10));
 | |
| INSERT INTO t1 SELECT a + 1, b FROM t1;
 | |
| INSERT INTO t1 SELECT a + 2, b FROM t1;
 | |
| INSERT INTO t1 SELECT a + 4, b FROM t1;
 | |
| INSERT INTO t1 SELECT a + 8, b FROM t1;
 | |
| 
 | |
| ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (64));
 | |
| ALTER TABLE t1 DROP PARTITION p1;
 | |
| 
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # Bug #30484: Partitions: crash with self-referencing trigger
 | |
| #
 | |
| 
 | |
| create table t (s1 int) engine=myisam partition by key (s1);
 | |
| create trigger t_ad after delete on t for each row insert into t values (old.s1);
 | |
| insert into t values (1);
 | |
| drop table t;
 | |
| 
 | |
| #
 | |
| # Bug #27816: Log tables ran with partitions crashes the server when logging
 | |
| # is enabled.
 | |
| #
 | |
| 
 | |
| USE mysql;
 | |
| SET GLOBAL general_log = 0;
 | |
| ALTER TABLE general_log ENGINE = MyISAM;
 | |
| --error ER_WRONG_USAGE
 | |
| ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
 | |
|   (PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
 | |
| ALTER TABLE general_log ENGINE = CSV;
 | |
| SET GLOBAL general_log = default;
 | |
| use test;
 | |
| 
 | |
| #
 | |
| # Bug #27084 partitioning by list seems failing when using case 
 | |
| # BUG #18198: Case no longer supported, test case removed
 | |
| #
 | |
| 
 | |
| create table t2 (b int);
 | |
| --error ER_BAD_FIELD_ERROR
 | |
| create table t1 (b int)
 | |
| PARTITION BY RANGE (t2.b) (
 | |
|   PARTITION p1 VALUES LESS THAN (10),
 | |
|   PARTITION p2 VALUES LESS THAN (20)
 | |
| ) select * from t2;
 | |
| create table t1 (a int)
 | |
| PARTITION BY RANGE (b) (
 | |
|   PARTITION p1 VALUES LESS THAN (10),
 | |
|   PARTITION p2 VALUES LESS THAN (20)
 | |
| ) select * from t2;
 | |
| show create table t1;
 | |
| drop table t1, t2;
 | |
| 
 | |
| #
 | |
| # Bug #32067 Partitions: crash with timestamp column
 | |
| #  this bug occurs randomly on some UPDATE statement
 | |
| #  with the '1032: Can't find record in 't1'' error
 | |
| 
 | |
| create table t1
 | |
|  (s1 timestamp on update current_timestamp, s2 int)
 | |
|  partition by key(s1) partitions 3;
 | |
| 
 | |
| insert into t1 values (null,null);
 | |
| --disable_query_log
 | |
| let $cnt= 1000;
 | |
| while ($cnt)
 | |
| {
 | |
|   update t1 set s2 = 1;
 | |
|   update t1 set s2 = 2;
 | |
|   dec $cnt;
 | |
| }
 | |
| --enable_query_log
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG#32272: partition crash 1: enum column
 | |
| #
 | |
| create table t1 (
 | |
|   c0 int,
 | |
|   c1 bigint,
 | |
|   c2 set('sweet'),
 | |
|   key (c2,c1,c0), 
 | |
|   key(c0)
 | |
| ) engine=myisam partition by hash (month(c0)) partitions 5;
 | |
| 
 | |
| --disable_warnings
 | |
| insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019;
 | |
| insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644;
 | |
| --enable_warnings
 | |
| # This must not fail assert:
 | |
| select c1 from t1 group by (select c0 from t1 limit 1);
 | |
| drop table t1;
 | |
| 
 | |
| # Bug #30495: optimize table t1,t2,t3 extended errors
 | |
| #
 | |
| CREATE TABLE t1(a int)
 | |
| PARTITION BY RANGE (a) (
 | |
|   PARTITION p1 VALUES LESS THAN (10),
 | |
|   PARTITION p2 VALUES LESS THAN (20)
 | |
| );
 | |
| --error 1064
 | |
| ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED;
 | |
| --error 1064
 | |
| ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # Bug #29258: Partitions: search fails for maximum unsigned bigint
 | |
| #
 | |
| CREATE TABLE t1 (s1 BIGINT UNSIGNED)
 | |
|   PARTITION BY RANGE (s1) (
 | |
|   PARTITION p0 VALUES LESS THAN (0), 
 | |
|   PARTITION p1 VALUES LESS THAN (1), 
 | |
|   PARTITION p2 VALUES LESS THAN (18446744073709551615)
 | |
| );
 | |
| INSERT INTO t1 VALUES (0), (18446744073709551614);
 | |
| --error ER_NO_PARTITION_FOR_GIVEN_VALUE
 | |
| INSERT INTO t1 VALUES (18446744073709551615);
 | |
| DROP TABLE t1;
 | |
| 
 | |
| CREATE TABLE t1 (s1 BIGINT UNSIGNED)
 | |
|  PARTITION BY RANGE (s1) (
 | |
|   PARTITION p0 VALUES LESS THAN (0),
 | |
|   PARTITION p1 VALUES LESS THAN (1),
 | |
|   PARTITION p2 VALUES LESS THAN (18446744073709551614),
 | |
|   PARTITION p3 VALUES LESS THAN MAXVALUE
 | |
| );
 | |
| INSERT INTO t1 VALUES (-1), (0), (18446744073709551613), 
 | |
|   (18446744073709551614), (18446744073709551615);
 | |
| SELECT * FROM t1;
 | |
| SELECT * FROM t1 WHERE s1 = 0;
 | |
| SELECT * FROM t1 WHERE s1 = 18446744073709551614;
 | |
| SELECT * FROM t1 WHERE s1 = 18446744073709551615;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| CREATE TABLE t1 (s1 BIGINT UNSIGNED)  
 | |
|  PARTITION BY RANGE (s1) (
 | |
|   PARTITION p0 VALUES LESS THAN (0),
 | |
|   PARTITION p1 VALUES LESS THAN (1),
 | |
|   PARTITION p2 VALUES LESS THAN (18446744073709551615),
 | |
|   PARTITION p3 VALUES LESS THAN MAXVALUE
 | |
| );
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # Bug #31890 Partitions: ORDER BY DESC in InnoDB not working
 | |
| #
 | |
| 
 | |
| CREATE TABLE t1
 | |
| (int_column INT, char_column CHAR(5),
 | |
| PRIMARY KEY(char_column,int_column))
 | |
| PARTITION BY KEY(char_column,int_column)
 | |
| PARTITIONS 101;
 | |
| INSERT INTO t1 (int_column, char_column) VALUES
 | |
| (      39868 ,'zZZRW'),       
 | |
| (     545592 ,'zZzSD'),       
 | |
| (       4936 ,'zzzsT'),       
 | |
| (       9274 ,'ZzZSX'),       
 | |
| (     970185 ,'ZZzTN'),       
 | |
| (     786036 ,'zZzTO'),       
 | |
| (      37240 ,'zZzTv'),       
 | |
| (     313801 ,'zzzUM'),       
 | |
| (     782427 ,'ZZZva'),       
 | |
| (     907955 ,'zZZvP'),       
 | |
| (     453491 ,'zzZWV'),       
 | |
| (     756594 ,'ZZZXU'),       
 | |
| (     718061 ,'ZZzZH');       
 | |
| SELECT * FROM t1 ORDER BY char_column DESC;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table)
 | |
| #
 | |
| 
 | |
| CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
 | |
|                 user CHAR(25), PRIMARY KEY(id))
 | |
|                    PARTITION BY RANGE(id)
 | |
|                    SUBPARTITION BY hash(id) subpartitions 2
 | |
|                    (PARTITION pa1 values less than (10),
 | |
|                     PARTITION pa2 values less than (20),
 | |
|                     PARTITION pa11 values less than MAXVALUE);
 | |
| --disable_query_log
 | |
| let $n= 15;
 | |
| while ($n)
 | |
| {
 | |
|   insert into t1 (user) values ('mysql');
 | |
|   dec $n;
 | |
| }
 | |
| --enable_query_log
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| --echo End of 5.1 tests
 |