1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Bug #27084 partitioning by list seems failing when using case

creation of the partitioned table could fail as we created Item-s for
it's list function in thd->mem_root, and then do Item->fix_fields
in the context of other table->mem_root (so that memory alloced
there was alloced in this table->mem_root). As we freed the
table->mem_root before we do thd->free_items, our Item-s had
pointers to the freed memory, that caused the crash


mysql-test/r/partition.result:
  result
mysql-test/t/partition.test:
  testcase
sql/item_cmpfunc.cc:
  here is better place for the implementation
sql/item_cmpfunc.h:
  implementation moved to .cc file
sql/sql_partition.cc:
  work_part_info_used parameter added to mysql_unpack_partition
sql/sql_partition.h:
  work_part_info_used parameter added to mysql_unpack_partition
sql/table.cc:
  we do 'fix_partition_func' using the proper arena now.
  It's necessary as Item_*::fix_fields can alloc memory
  using thd->mem_root and this has to be same mem_root that
  we used to alloc these Item-s
This commit is contained in:
unknown
2007-03-27 16:15:38 +05:00
parent 7bc013444a
commit 50563d3930
7 changed files with 60 additions and 16 deletions

View File

@@ -3684,6 +3684,8 @@ void get_partition_set(const TABLE *table, byte *buf, const uint index,
table Table object of partitioned table
create_table_ind Is it called from CREATE TABLE
default_db_type What is the default engine of the table
work_part_info_used Flag is raised if we don't create new
part_info, but used thd->work_part_info
RETURN VALUE
TRUE Error
@@ -3704,7 +3706,8 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
uint part_info_len,
uchar *part_state, uint part_state_len,
TABLE* table, bool is_create_table_ind,
handlerton *default_db_type)
handlerton *default_db_type,
bool *work_part_info_used)
{
bool result= TRUE;
partition_info *part_info;
@@ -3716,6 +3719,7 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
thd->lex= &lex;
thd->variables.character_set_client= system_charset_info;
lex_start(thd, part_buf, part_info_len);
*work_part_info_used= false;
/*
We need to use the current SELECT_LEX since I need to keep the
Name_resolution_context object which is referenced from the
@@ -3805,6 +3809,7 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
thd->free_items();
part_info= thd->work_part_info;
table->s->version= 0UL;
*work_part_info_used= true;
}
}
table->part_info= part_info;