1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Manual merge from mysql-trunk-merge.

Conflicts:
  - mysql-test/suite/rpl/r/rpl_binlog_grant.result
  - mysql-test/suite/rpl/r/rpl_sp.result
  - mysql-test/suite/rpl/t/rpl_binlog_grant.test
  - sql/sql_parse.cc
  - sql/sql_table.cc
  - sql/sql_test.cc
This commit is contained in:
Alexander Nozdrin
2010-01-31 01:06:50 +03:00
47 changed files with 2938 additions and 469 deletions

View File

@ -542,13 +542,26 @@ JOIN::prepare(Item ***rref_pointer_array,
if (order)
{
bool real_order= FALSE;
ORDER *ord;
for (ord= order; ord; ord= ord->next)
{
Item *item= *ord->item;
/*
Disregard sort order if there's only "{VAR}CHAR(0) NOT NULL" fields
there. Such fields don't contain any data to sort.
*/
if (!real_order &&
(item->type() != Item::Item::FIELD_ITEM ||
((Item_field *) item)->field->maybe_null() ||
((Item_field *) item)->field->sort_length()))
real_order= TRUE;
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
item->split_sum_func(thd, ref_pointer_array, all_fields);
}
if (!real_order)
order= NULL;
}
if (having && having->with_sum_func)