summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@hfmain.(none)>2007-03-22 12:20:51 +0400
committerunknown <holyfoot/hf@hfmain.(none)>2007-03-22 12:20:51 +0400
commitd152debde52cf1a8c3690a05fc6fe54f613fc008 (patch)
treeeddfd478f114ee98f384a977c9aee7847e9376e4 /sql/sql_select.cc
parent8ed9a54008fae160d63dc27fa02b9ae4348238e7 (diff)
parent9f9e2f2df02ba7cbeb075ea345f979eb244f97a6 (diff)
downloadmariadb-git-d152debde52cf1a8c3690a05fc6fe54f613fc008.tar.gz
Merge bk@192.168.21.1:mysql-5.1
into mysql.com:/home/hf/work/mrg/mysql-5.1-opt libmysqld/lib_sql.cc: Auto merged sql/item.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e7ade996d87..582df11c8c1 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -408,12 +408,14 @@ JOIN::prepare(Item ***rref_pointer_array,
/* Check that all tables, fields, conds and order are ok */
- if ((!(select_options & OPTION_SETUP_TABLES_DONE) &&
- setup_tables_and_check_access(thd, &select_lex->context, join_list,
- tables_list,
- &select_lex->leaf_tables, FALSE,
- SELECT_ACL, SELECT_ACL)) ||
- setup_wild(thd, tables_list, fields_list, &all_fields, wild_num) ||
+ if (!(select_options & OPTION_SETUP_TABLES_DONE) &&
+ setup_tables_and_check_access(thd, &select_lex->context, join_list,
+ tables_list, &select_lex->leaf_tables,
+ FALSE, SELECT_ACL, SELECT_ACL))
+ DBUG_RETURN(-1);
+ tables= thd->leaf_count;
+
+ if (setup_wild(thd, tables_list, fields_list, &all_fields, wild_num) ||
select_lex->setup_ref_array(thd, og_num) ||
setup_fields(thd, (*rref_pointer_array), fields_list, MARK_COLUMNS_READ,
&all_fields, 1) ||
@@ -518,11 +520,6 @@ JOIN::prepare(Item ***rref_pointer_array,
DBUG_RETURN(-1);
}
}
- TABLE_LIST *table_ptr;
- for (table_ptr= select_lex->leaf_tables;
- table_ptr;
- table_ptr= table_ptr->next_leaf)
- tables++;
}
{
/* Caclulate the number of groups */
@@ -6635,7 +6632,8 @@ static void update_depend_map(JOIN *join, ORDER *order)
order->item[0]->update_used_tables();
order->depend_map=depend_map=order->item[0]->used_tables();
// Not item_sum(), RAND() and no reference to table outside of sub select
- if (!(order->depend_map & (OUTER_REF_TABLE_BIT | RAND_TABLE_BIT)))
+ if (!(order->depend_map & (OUTER_REF_TABLE_BIT | RAND_TABLE_BIT))
+ && !order->item[0]->with_sum_func)
{
for (JOIN_TAB **tab=join->map2table;
depend_map ;