summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2002-11-11 10:49:41 +0200
committerunknown <bell@sanja.is.com.ua>2002-11-11 10:49:41 +0200
commit4832ebce861836db812dd2863ee134e53c44963b (patch)
treefd9d0554ea576b579ddefeaa6efd8a371a36ae00 /sql/sql_derived.cc
parent828c0e9ac197f92d4b6d11aa58c312aef2c12c20 (diff)
downloadmariadb-git-4832ebce861836db812dd2863ee134e53c44963b.tar.gz
prevent using expernal fields in derived tables
mysql-test/r/subselect.result: test of derived table external field bug mysql-test/t/subselect.test: test of derived table external field bug sql/sql_derived.cc: lex->current_select always should point on current SELECT_LEX_NODE during query execution
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 93627409d27..5dbbf39e7d4 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -94,13 +94,17 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
unit->select_limit_cnt= HA_POS_ERROR;
if (unit->select_limit_cnt == HA_POS_ERROR)
sl->options&= ~OPTION_FOUND_ROWS;
-
+
+ SELECT_LEX_NODE *save_current_select= lex->current_select;
+ lex->current_select= sl;
res= mysql_select(thd, tables, sl->item_list,
sl->where, (ORDER *) sl->order_list.first,
(ORDER*) sl->group_list.first,
sl->having, (ORDER*) NULL,
sl->options | thd->options | SELECT_NO_UNLOCK,
derived_result, unit, sl, 0);
+ lex->current_select= save_current_select;
+
if (!res)
{
// Here we entirely fix both TABLE_LIST and list of SELECT's as there were no derived tables