summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@rakia.(none)>2006-09-05 19:22:55 +0300
committerunknown <gkodinov/kgeorge@rakia.(none)>2006-09-05 19:22:55 +0300
commitb527a75e01b128f9e171e144c7658f8d8c5f0716 (patch)
treea80f6c98ae90766dca145b0ba57d6783765b5ca5 /sql/sql_select.cc
parentff1d115e3a1b7db1c38826addb076424ee3330b4 (diff)
parentd3dd6fa0084d6c89b71cb7d700a164a9f6e0da87 (diff)
downloadmariadb-git-b527a75e01b128f9e171e144c7658f8d8c5f0716.tar.gz
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-4.1-opt
into rakia.(none):/home/kgeorge/mysql/autopush/B16792-4.1-opt mysql-test/r/subselect.result: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f0859564a5e..5154bff78dd 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1131,7 +1131,7 @@ JOIN::exec()
DBUG_VOID_RETURN;
}
- if (!tables_list)
+ if (!tables_list && (tables || !select_lex->with_sum_func))
{ // Only test of functions
if (select_options & SELECT_DESCRIBE)
select_describe(this, FALSE, FALSE, FALSE,
@@ -1170,7 +1170,12 @@ JOIN::exec()
thd->examined_row_count= 0;
DBUG_VOID_RETURN;
}
- thd->limit_found_rows= thd->examined_row_count= 0;
+ /*
+ don't reset the found rows count if there're no tables
+ as FOUND_ROWS() may be called.
+ */
+ if (tables)
+ thd->limit_found_rows= thd->examined_row_count= 0;
if (zero_result_cause)
{
@@ -1209,7 +1214,8 @@ JOIN::exec()
having= tmp_having;
select_describe(this, need_tmp,
order != 0 && !skip_sort_order,
- select_distinct);
+ select_distinct,
+ !tables ? "No tables used" : NullS);
DBUG_VOID_RETURN;
}
@@ -6042,9 +6048,12 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
else
end_select=end_send;
}
- join->join_tab[join->tables-1].next_select=end_select;
+ if (join->tables)
+ {
+ join->join_tab[join->tables-1].next_select=end_select;
- join_tab=join->join_tab+join->const_tables;
+ join_tab=join->join_tab+join->const_tables;
+ }
join->send_records=0;
if (join->tables == join->const_tables)
{
@@ -6062,6 +6071,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
}
else
{
+ DBUG_ASSERT(join_tab);
error= sub_select(join,join_tab,0);
if (error >= 0)
error= sub_select(join,join_tab,1);