BUG#19903: Add partition crashes

Added new test cases
parent f8bbea4b
SET @max_row = 20;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
PRIMARY KEY(f_int1))
ENGINE = MEMORY;
INSERT INTO t0_template
SET f_int1 = 20, f_int2 = 20, f_char1 = '20', f_char2 = '20',
f_charbig = '===20===';
INSERT INTO t0_template
SET f_int1 = 19, f_int2 = 19, f_char1 = '19', f_char2 = '19',
f_charbig = '===19===';
INSERT INTO t0_template
SET f_int1 = 18, f_int2 = 18, f_char1 = '18', f_char2 = '18',
f_charbig = '===18===';
INSERT INTO t0_template
SET f_int1 = 17, f_int2 = 17, f_char1 = '17', f_char2 = '17',
f_charbig = '===17===';
INSERT INTO t0_template
SET f_int1 = 16, f_int2 = 16, f_char1 = '16', f_char2 = '16',
f_charbig = '===16===';
INSERT INTO t0_template
SET f_int1 = 15, f_int2 = 15, f_char1 = '15', f_char2 = '15',
f_charbig = '===15===';
INSERT INTO t0_template
SET f_int1 = 14, f_int2 = 14, f_char1 = '14', f_char2 = '14',
f_charbig = '===14===';
INSERT INTO t0_template
SET f_int1 = 13, f_int2 = 13, f_char1 = '13', f_char2 = '13',
f_charbig = '===13===';
INSERT INTO t0_template
SET f_int1 = 12, f_int2 = 12, f_char1 = '12', f_char2 = '12',
f_charbig = '===12===';
INSERT INTO t0_template
SET f_int1 = 11, f_int2 = 11, f_char1 = '11', f_char2 = '11',
f_charbig = '===11===';
INSERT INTO t0_template
SET f_int1 = 10, f_int2 = 10, f_char1 = '10', f_char2 = '10',
f_charbig = '===10===';
INSERT INTO t0_template
SET f_int1 = 9, f_int2 = 9, f_char1 = '9', f_char2 = '9',
f_charbig = '===9===';
INSERT INTO t0_template
SET f_int1 = 8, f_int2 = 8, f_char1 = '8', f_char2 = '8',
f_charbig = '===8===';
INSERT INTO t0_template
SET f_int1 = 7, f_int2 = 7, f_char1 = '7', f_char2 = '7',
f_charbig = '===7===';
INSERT INTO t0_template
SET f_int1 = 6, f_int2 = 6, f_char1 = '6', f_char2 = '6',
f_charbig = '===6===';
INSERT INTO t0_template
SET f_int1 = 5, f_int2 = 5, f_char1 = '5', f_char2 = '5',
f_charbig = '===5===';
INSERT INTO t0_template
SET f_int1 = 4, f_int2 = 4, f_char1 = '4', f_char2 = '4',
f_charbig = '===4===';
INSERT INTO t0_template
SET f_int1 = 3, f_int2 = 3, f_char1 = '3', f_char2 = '3',
f_charbig = '===3===';
INSERT INTO t0_template
SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2',
f_charbig = '===2===';
INSERT INTO t0_template
SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1',
f_charbig = '===1===';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) engine='InnoDB';
INSERT INTO t1 (f_date, f_varchar)
SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR)
FROM t0_template
WHERE f_int1 + 999 BETWEEN 1000 AND 9999;
SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1)
INTO @exp_row_count;
ALTER TABLE t1 PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER));
# 1.1.5 Add two named partitions + test
ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
DROP VIEW IF EXISTS v1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t0_aux;
DROP TABLE IF EXISTS t0_definition;
DROP TABLE IF EXISTS t0_template;
-- source include/have_innodb.inc
SET @max_row = 20;
let $engine= 'InnoDB';
let $MAX_VALUE= (2147483646);
let $max_row= `SELECT @max_row`;
# Column list with definition for all tables to be checked
let $column_list= f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000);
let $sub_part_no= 3;
--disable_warnings
DROP TABLE IF EXISTS t0_template;
--enable_warnings
eval CREATE TABLE t0_template (
$column_list ,
PRIMARY KEY(f_int1))
ENGINE = MEMORY;
let $num= `SELECT @max_row`;
while ($num)
{
eval INSERT INTO t0_template
SET f_int1 = $num, f_int2 = $num, f_char1 = '$num', f_char2 = '$num',
f_charbig = '===$num===';
dec $num;
}
# 1. Create the table
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
eval CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) engine=$engine;
# 2. Fill the table t1 with records
INSERT INTO t1 (f_date, f_varchar)
SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR)
FROM t0_template
WHERE f_int1 + 999 BETWEEN 1000 AND 9999;
# 3. Calculate the number of inserted records.
SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1)
INTO @exp_row_count;
# DEBUG SELECT @exp_row_count;
# 4. Print the layout, check Readability
ALTER TABLE t1 PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER));
--echo # 1.1.5 Add two named partitions + test
ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
--disable_warnings
DROP VIEW IF EXISTS v1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t0_aux;
DROP TABLE IF EXISTS t0_definition;
DROP TABLE IF EXISTS t0_template;
--enable_warnings
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment