mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb
This commit is contained in:
@ -7826,12 +7826,17 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
|
||||
sprintf(filename, "%s_%lx_%i", tmp_file_prefix,
|
||||
current_pid, temp_pool_slot);
|
||||
else // if we run out of slots or we are not using tempool
|
||||
else
|
||||
{
|
||||
/* if we run out of slots or we are not using tempool */
|
||||
sprintf(filename,"%s%lx_%lx_%x",tmp_file_prefix,current_pid,
|
||||
thd->thread_id, thd->tmp_table++);
|
||||
}
|
||||
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(files_charset_info, path);
|
||||
/*
|
||||
No need for change table name to lower case as we are only creating
|
||||
MyISAM or HEAP tables here
|
||||
*/
|
||||
sprintf(path, "%s%s", mysql_tmpdir, filename);
|
||||
|
||||
if (group)
|
||||
@ -10424,15 +10429,24 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
||||
}
|
||||
else
|
||||
{
|
||||
select->quick->head->file->ha_index_end();
|
||||
/*
|
||||
We have verified above that select->quick is not
|
||||
index_merge quick select.
|
||||
*/
|
||||
select->quick->index= new_ref_key;
|
||||
select->quick->init();
|
||||
/*
|
||||
The range optimizer constructed QUICK_RANGE for ref_key, and
|
||||
we want to use instead new_ref_key as the index. We can't
|
||||
just change the index of the quick select, because this may
|
||||
result in an incosistent QUICK_SELECT object. Below we
|
||||
create a new QUICK_SELECT from scratch so that all its
|
||||
parameres are set correctly by the range optimizer.
|
||||
*/
|
||||
key_map new_ref_key_map;
|
||||
new_ref_key_map.clear_all(); /* Force the creation of quick select */
|
||||
new_ref_key_map.set_bit(new_ref_key); /* only for new_ref_key. */
|
||||
|
||||
if (select->test_quick_select(tab->join->thd, new_ref_key_map, 0,
|
||||
(tab->join->select_options & OPTION_FOUND_ROWS) ?
|
||||
HA_POS_ERROR : tab->join->unit->select_limit_cnt) <= 0)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
ref_key= new_ref_key;
|
||||
ref_key= new_ref_key;
|
||||
}
|
||||
}
|
||||
/* Check if we get the rows in requested sorted order by using the key */
|
||||
|
Reference in New Issue
Block a user