Commit ee9930bf authored by unknown's avatar unknown
Browse files

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

  store copy of partition function string


mysql-test/r/partition.result:
  Fix for bug#14363 Partitions: failure if create in stored procedure
    test case
mysql-test/t/partition.test:
  Fix for bug#14363 Partitions: failure if create in stored procedure
    test case
parent 0466a909
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -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;
f_int1	f_int2	f_char1	f_char2	f_charbig
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
+35 −0
Original line number Diff line number Diff line
@@ -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;
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
+2 −2
Original line number Diff line number Diff line
@@ -3489,7 +3489,7 @@ part_func:
          uint expr_len= (uint)($4 - $2) - 1;
          lex->part_info->list_of_part_fields= FALSE;
          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;
        }
        ;
@@ -3501,7 +3501,7 @@ sub_part_func:
          uint expr_len= (uint)($4 - $2) - 1;
          lex->part_info->list_of_subpart_fields= FALSE;
          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;
        }
        ;