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/unireg.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/unireg.cc')
-rw-r--r-- | sql/unireg.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc index 065f8583f71..0ab77462f61 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -90,7 +90,7 @@ bool mysql_create_frm(THD *thd, my_string file_name, if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0))) DBUG_RETURN(1); if (db_file == NULL) - db_file= get_new_handler((TABLE*) 0, create_info->db_type); + db_file= get_new_handler((TABLE*) 0, thd->mem_root, create_info->db_type); /* If fixed row records, we need one bit to check for deleted rows */ if (!(create_info->table_options & HA_OPTION_PACK_RECORD)) @@ -699,7 +699,7 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type, /* We need a table to generate columns for default values */ bzero((char*) &table,sizeof(table)); table.s= &table.share_not_to_be_used; - handler= get_new_handler((TABLE*) 0, table_type); + handler= get_new_handler((TABLE*) 0, thd->mem_root, table_type); if (!handler || !(buff=(uchar*) my_malloc((uint) reclength,MYF(MY_WME | MY_ZEROFILL)))) |