Fix for bug#14363 Partitions: failure if create in stored procedure

  store copy of partition function string
parent 701110c9
...@@ -348,4 +348,29 @@ INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charb ...@@ -348,4 +348,29 @@ INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charb
SELECT * FROM t1 WHERE f_int1 IS NULL; SELECT * FROM t1 WHERE f_int1 IS NULL;
f_int1 f_int2 f_char1 f_char2 f_charbig f_int1 f_int2 f_char1 f_char2 f_charbig
drop table t1; drop table t1;
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//
End of 5.1 tests End of 5.1 tests
...@@ -448,4 +448,39 @@ INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charb ...@@ -448,4 +448,39 @@ INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charb
SELECT * FROM t1 WHERE f_int1 IS NULL; SELECT * FROM t1 WHERE f_int1 IS NULL;
drop table t1; 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 ;//
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -3489,7 +3489,7 @@ part_func: ...@@ -3489,7 +3489,7 @@ part_func:
uint expr_len= (uint)($4 - $2) - 1; uint expr_len= (uint)($4 - $2) - 1;
lex->part_info->list_of_part_fields= FALSE; lex->part_info->list_of_part_fields= FALSE;
lex->part_info->part_expr= $3; lex->part_info->part_expr= $3;
lex->part_info->part_func_string= $2+1; lex->part_info->part_func_string= (char* ) sql_memdup($2+1, expr_len);
lex->part_info->part_func_len= expr_len; lex->part_info->part_func_len= expr_len;
} }
; ;
...@@ -3501,7 +3501,7 @@ sub_part_func: ...@@ -3501,7 +3501,7 @@ sub_part_func:
uint expr_len= (uint)($4 - $2) - 1; uint expr_len= (uint)($4 - $2) - 1;
lex->part_info->list_of_subpart_fields= FALSE; lex->part_info->list_of_subpart_fields= FALSE;
lex->part_info->subpart_expr= $3; lex->part_info->subpart_expr= $3;
lex->part_info->subpart_func_string= $2+1; lex->part_info->subpart_func_string= (char* ) sql_memdup($2+1, expr_len);
lex->part_info->subpart_func_len= expr_len; lex->part_info->subpart_func_len= expr_len;
} }
; ;
......
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