diff options
Diffstat (limited to 'mysql-test/r/partition.result')
-rw-r--r-- | mysql-test/r/partition.result | 172 |
1 files changed, 169 insertions, 3 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 83ff66eabe5..0febdbc38d0 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,5 +1,105 @@ drop table if exists t1, t2; # +# Bug#11765667: bug#58655: ASSERTION FAILED, +# SERVER CRASHES WITH MYSQLD GOT SIGNAL 6 +# +CREATE TABLE t1 ( +id MEDIUMINT NOT NULL AUTO_INCREMENT, +dt DATE, st VARCHAR(255), uid INT, +id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt) +); +INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES +('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'), +('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'), +('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'), +('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'), +('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'), +('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'), +('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'), +('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'), +('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'), +('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data'); +ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) ( +PARTITION d1 VALUES IN (1991, 1994), +PARTITION d2 VALUES IN (1993), +PARTITION d3 VALUES IN (1992, 1995, 1996) +); +INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES +('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row'); +UPDATE t1 SET filler='Updating the row' WHERE uid=298; +DROP TABLE t1; +# +# Bug#59297: Can't find record in 'tablename' on update inner join +# +CREATE TABLE t1 ( +a char(2) NOT NULL, +b char(2) NOT NULL, +c int(10) unsigned NOT NULL, +d varchar(255) DEFAULT NULL, +e varchar(1000) DEFAULT NULL, +PRIMARY KEY (a, b, c), +KEY (a), +KEY (a, b) +) +/*!50100 PARTITION BY KEY (a) +PARTITIONS 20 */; +INSERT INTO t1 (a, b, c, d, e) VALUES +('07', '03', 343, '1', '07_03_343'), +('01', '04', 343, '2', '01_04_343'), +('01', '06', 343, '3', '01_06_343'), +('01', '07', 343, '4', '01_07_343'), +('01', '08', 343, '5', '01_08_343'), +('01', '09', 343, '6', '01_09_343'), +('03', '03', 343, '7', '03_03_343'), +('03', '06', 343, '8', '03_06_343'), +('03', '07', 343, '9', '03_07_343'), +('04', '03', 343, '10', '04_03_343'), +('04', '06', 343, '11', '04_06_343'), +('05', '03', 343, '12', '05_03_343'), +('11', '03', 343, '13', '11_03_343'), +('11', '04', 343, '14', '11_04_343') +; +UPDATE t1 AS A, +(SELECT '03' AS a, '06' AS b, 343 AS c, 'last' AS d) AS B +SET A.e = B.d +WHERE A.a = '03' +AND A.b = '06' +AND A.c = 343; +DROP TABLE t1; +# +# Bug#57778: failed primary key add to partitioned innodb table +# inconsistent and crashes +# +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) +PARTITION BY KEY (a) PARTITIONS 2; +INSERT INTO t1 VALUES (0,1), (0,2); +ALTER TABLE t1 ADD PRIMARY KEY (a); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY KEY (a) +PARTITIONS 2 */ +SELECT * FROM t1; +a b +0 1 +0 2 +UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2; +ALTER TABLE t1 ADD PRIMARY KEY (a); +SELECT * FROM t1; +a b +1 1 +0 1 +ALTER TABLE t1 DROP PRIMARY KEY; +SELECT * FROM t1; +a b +1 1 +0 1 +DROP TABLE t1; +# # Bug#57113: ha_partition::extra(ha_extra_function): # Assertion `m_extra_cache' failed CREATE TABLE t1 @@ -118,6 +218,15 @@ a b 2007-07-30 17:35:48 p1 2009-07-14 17:35:55 pmax 2009-09-21 17:31:42 pmax +SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01'; +a b +2007-07-30 17:35:48 p1 +EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 +EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 ALTER TABLE t1 REORGANIZE PARTITION pmax INTO ( PARTITION p3 VALUES LESS THAN (1247688000), PARTITION pmax VALUES LESS THAN MAXVALUE); @@ -126,6 +235,15 @@ a b 2007-07-30 17:35:48 p1 2009-07-14 17:35:55 pmax 2009-09-21 17:31:42 pmax +SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01'; +a b +2007-07-30 17:35:48 p1 +EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 +EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -566,12 +684,12 @@ create table t1 (a bigint) partition by range (a) (partition p0 values less than (0xFFFFFFFFFFFFFFFF), partition p1 values less than (10)); -ERROR HY000: VALUES value must be of same type as partition function +ERROR HY000: VALUES value for partition 'p0' must have type INT create table t1 (a bigint) partition by list (a) (partition p0 values in (0xFFFFFFFFFFFFFFFF), partition p1 values in (10)); -ERROR HY000: VALUES value must be of same type as partition function +ERROR HY000: VALUES value for partition 'p0' must have type INT create table t1 (a bigint unsigned) partition by range (a) (partition p0 values less than (100), @@ -1868,7 +1986,7 @@ c1 bigint, c2 set('sweet'), key (c2,c1,c0), key(c0) -) engine=myisam partition by hash (month(c0)) partitions 5; +) engine=myisam partition by hash (c0) partitions 5; insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019; insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644; select c1 from t1 group by (select c0 from t1 limit 1); @@ -2231,3 +2349,51 @@ INSERT INTO t1 VALUES(0); DROP TABLE t1; SET GLOBAL myisam_use_mmap=default; End of 5.1 tests +# +# BUG#55385: UPDATE statement throws an error, but still updates +# the table entries +CREATE TABLE t1_part ( +partkey int, +nokey int +) PARTITION BY LINEAR HASH(partkey) PARTITIONS 3; +INSERT INTO t1_part VALUES (1, 1) , (10, 10); +CREATE VIEW v1 AS SELECT * FROM t1_part; + +# Should be (1,1),(10,10) +SELECT * FROM t1_part; +partkey nokey +1 1 +10 10 + +# Case 1 +# Update is refused because partitioning key is updated +UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.partkey = 2, B.nokey = 3; +ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'. +UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2, B.partkey = 3; +ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'. + +# Case 2 +# Like 1, but partition accessed through a view +UPDATE t1_part AS A NATURAL JOIN v1 as B SET A.nokey = 2 , B.partkey = 3; +ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'. +UPDATE v1 AS A NATURAL JOIN t1_part as B SET A.nokey = 2 , B.partkey = 3; +ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'. + +# Should be (1,1),(10,10) +SELECT * FROM t1_part; +partkey nokey +1 1 +10 10 + +# Case 3 +# Update is accepted because partitioning key is not updated +UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2 , B.nokey = 3; + +# Should be (1,3),(10,3) +SELECT * FROM t1_part; +partkey nokey +1 3 +10 3 + +DROP VIEW v1; +DROP TABLE t1_part; |