diff options
author | bell@sanja.is.com.ua <> | 2002-12-26 01:28:59 +0200 |
---|---|---|
committer | bell@sanja.is.com.ua <> | 2002-12-26 01:28:59 +0200 |
commit | 1dd7cb52aedf01ee0aaddcdde2cbeec2c1a124a4 (patch) | |
tree | 6a73d0cc2b8728ab821e54448c158fa784365acb /sql/sql_derived.cc | |
parent | 521ec3163e5de060d776e2e160fdab0d37ca7b6b (diff) | |
download | mariadb-git-1dd7cb52aedf01ee0aaddcdde2cbeec2c1a124a4.tar.gz |
support of subselect without FROM reducing (SCRUM)
fixed bug of calling setup_fields without correct lex->current_select pointer in mysql_derived
more correct creation of reference in Item_field::fix_field
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index f7d845e9e36..db516ae5f41 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -63,6 +63,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) TMP_TABLE_PARAM tmp_table_param; bool is_union=sl->next_select() && sl->next_select()->linkage == UNION_TYPE; DBUG_ENTER("mysql_derived"); + SELECT_LEX_NODE *save_current_select= lex->current_select; /* @@ -111,6 +112,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) } } + lex->current_select= sl; if (setup_fields(thd,tables,item_list,0,0,1)) { res=-1; @@ -119,7 +121,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) bzero((char*) &tmp_table_param,sizeof(tmp_table_param)); tmp_table_param.field_count=item_list.elements; if (!(table=create_tmp_table(thd, &tmp_table_param, item_list, - (ORDER*) 0, is_union && !unit->union_option, 1, + (ORDER*) 0, + is_union && !unit->union_option, 1, (sl->options | thd->options | TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR))) @@ -138,8 +141,6 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) 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; if (is_union) res=mysql_union(thd,lex,derived_result,unit); else @@ -149,7 +150,6 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) sl->having, (ORDER*) NULL, sl->options | thd->options | SELECT_NO_UNLOCK, derived_result, unit, sl, 0); - lex->current_select= save_current_select; if (!res) { @@ -184,6 +184,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) if (res) free_tmp_table(thd,table); exit: + lex->current_select= save_current_select; close_thread_tables(thd); } DBUG_RETURN(res); |