mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge with 4.1
BitKeeper/etc/ignore: auto-union client/mysqltest.c: Auto merged extra/my_print_defaults.c: Auto merged extra/perror.c: Auto merged extra/resolve_stack_dump.c: Auto merged include/help_end.h: Auto merged include/help_start.h: Auto merged myisam/myisamlog.c: Auto merged mysql-test/r/group_by.result: Auto merged mysql-test/r/heap_hash.result: Auto merged BitKeeper/deleted/.del-pack_isam.c~43801f0df7504834: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/t/subselect.test: Auto merged ndb/src/kernel/vm/FastScheduler.cpp: Auto merged netware/mysql_test_run.c: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_select.cc: Auto merged netware/BUILD/nwbootstrap: merge: keep local scripts/make_binary_distribution.sh: merge: keep local sql/ha_heap.cc: Trivial merge sql/ha_innodb.cc: Auto merge (Code already existed in 5.0) sql/item_cmpfunc.cc: Simple merge sql/item_func.cc: Simple merge sql/item_row.cc: Simple merge sql/item_strfunc.cc: Simple merge sql/item_subselect.cc: Merge with sanjas optimzation patch, but keep old code withing ifdef as a reference until this is fixed
This commit is contained in:
@@ -8247,6 +8247,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
keyinfo->key_length=(uint16) reclength;
|
||||
keyinfo->name= (char*) "distinct_key";
|
||||
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
|
||||
keyinfo->rec_per_key=0;
|
||||
if (null_pack_length)
|
||||
{
|
||||
key_part_info->null_bit=0;
|
||||
@@ -11831,6 +11832,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||
res_selected_fields.empty();
|
||||
res_all_fields.empty();
|
||||
List_iterator_fast<Item> itr(res_all_fields);
|
||||
List<Item> extra_funcs;
|
||||
uint i, border= all_fields.elements - elements;
|
||||
DBUG_ENTER("setup_copy_fields");
|
||||
|
||||
@@ -11892,7 +11894,12 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||
*/
|
||||
if (!(pos=new Item_copy_string(pos)))
|
||||
goto err;
|
||||
if (param->copy_funcs.push_back(pos))
|
||||
if (i < border) // HAVING, ORDER and GROUP BY
|
||||
{
|
||||
if (extra_funcs.push_back(pos))
|
||||
goto err;
|
||||
}
|
||||
else if (param->copy_funcs.push_back(pos))
|
||||
goto err;
|
||||
}
|
||||
res_all_fields.push_back(pos);
|
||||
@@ -11904,6 +11911,12 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||
for (i= 0; i < border; i++)
|
||||
itr++;
|
||||
itr.sublist(res_selected_fields, elements);
|
||||
/*
|
||||
Put elements from HAVING, ORDER BY and GROUP BY last to ensure that any
|
||||
reference used in these will resolve to a item that is already calculated
|
||||
*/
|
||||
param->copy_funcs.concat(&extra_funcs);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
|
||||
Reference in New Issue
Block a user