diff options
author | unknown <konstantin@mysql.com> | 2005-11-03 14:20:13 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-11-03 14:20:13 +0300 |
commit | 3fa0dd23e0b6df54f8c94085963264c17c3cd715 (patch) | |
tree | 639d3dad03adaaad1f20eb9859a38a80c26f6b13 /sql/sql_select.cc | |
parent | e2220f476680d60a5f35b9dcef6920862d578f80 (diff) | |
download | mariadb-git-3fa0dd23e0b6df54f8c94085963264c17c3cd715.tar.gz |
A fix and a test case for Bug#14210 "Simple query with > operator on
large table gives server crash": make sure that when a MyISAM temporary
table is created for a cursor, it's created in its memory root,
not the memory root of the current query.
mysql-test/r/sp.result:
Test results fixed: a test case for Bug#14210
mysql-test/t/sp.test:
A test case for Bug#14210 "Simple query with > operator on large table
gives server crash"
sql/handler.cc:
- rewrite get_new_handler to accept a memory root and use it for
sql/handler.h:
- get_new_handler declaration changed
sql/opt_range.cc:
- get_new_handler declaration changed
sql/sql_base.cc:
- get_new_handler declaration changed
sql/sql_select.cc:
- the actual fix for Bug#14210. In create_myisam_from_heap we should
create the new table handler in TABLE::mem_root, not in THD::mem_root:
the latter is freed shortly after cursor is open.
- adjust create_tmp_table to explicitly supply &table->mem_root
to get_new_handler when creating a handler for a new temporary table
sql/sql_table.cc:
- get_new_handler declaration changed
sql/table.cc:
- get_new_handler declaration changed
sql/unireg.cc:
- get_new_handler declaration changed
tests/mysql_client_test.c:
A test case for Bug#14210 "Simple query with > operator on large table
gives server crash": a C API test case is worth adding because of different
memory allocation/freeing patterns in handling of C API and SP cursors
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 285a5c5696b..f6e1f7e80e9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8279,7 +8279,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, (select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) == OPTION_BIG_TABLES || (select_options & TMP_TABLE_FORCE_MYISAM)) { - table->file=get_new_handler(table,table->s->db_type= DB_TYPE_MYISAM); + table->file= get_new_handler(table, &table->mem_root, + table->s->db_type= DB_TYPE_MYISAM); if (group && (param->group_parts > table->file->max_key_parts() || param->group_length > table->file->max_key_length())) @@ -8287,7 +8288,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, } else { - table->file=get_new_handler(table,table->s->db_type= DB_TYPE_HEAP); + table->file= get_new_handler(table, &table->mem_root, + table->s->db_type= DB_TYPE_HEAP); } if (!using_unique_constraint) @@ -8871,7 +8873,8 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, new_table= *table; new_table.s= &new_table.share_not_to_be_used; new_table.s->db_type= DB_TYPE_MYISAM; - if (!(new_table.file= get_new_handler(&new_table,DB_TYPE_MYISAM))) + if (!(new_table.file= get_new_handler(&new_table, &new_table.mem_root, + DB_TYPE_MYISAM))) DBUG_RETURN(1); // End of memory save_proc_info=thd->proc_info; |