diff options
author | bell@sanja.is.com.ua <> | 2004-02-18 22:14:41 +0200 |
---|---|---|
committer | bell@sanja.is.com.ua <> | 2004-02-18 22:14:41 +0200 |
commit | 2d5338ceb07e2cd42a57a186ba95de272121a48e (patch) | |
tree | 1e140aaabc0f3d139661382d463efbcdfcae32e7 /sql | |
parent | a66b398eb8a8365c2070939a0a826be1d6a8708b (diff) | |
download | mariadb-git-2d5338ceb07e2cd42a57a186ba95de272121a48e.tar.gz |
revision of fix_fields calls in subqueries transformation
after merge fix
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_subselect.cc | 43 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 2 |
2 files changed, 38 insertions, 7 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index e0177f08764..a8e236d3e0a 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -713,9 +713,14 @@ Item_in_subselect::single_value_transformer(JOIN *join, select_lex->ref_pointer_array, (char *)"<ref>", this->full_name())); + /* + AND and comparison functions can't be changed during fix_fields() + we can assign select_lex->having here, and pass 0 as last + argument (reference) to fix_fields() + */ select_lex->having= join->having= and_items(join->having, item); select_lex->having_fix_field= 1; - if (join->having->fix_fields(thd, join->tables_list, &join->having)) + if (join->having->fix_fields(thd, join->tables_list, 0)) { select_lex->having_fix_field= 0; goto err; @@ -735,13 +740,17 @@ Item_in_subselect::single_value_transformer(JOIN *join, if (!abort_on_null) { having= new Item_is_not_null_test(this, having); + /* + Item_is_not_null_test can't be changed during fix_fields() + we can assign select_lex->having here, and pass 0 as last + argument (reference) to fix_fields() + */ select_lex->having= join->having= (join->having ? new Item_cond_and(having, join->having) : having); select_lex->having_fix_field= 1; - if (join->having->fix_fields(thd, join->tables_list, - &join->having)) + if (join->having->fix_fields(thd, join->tables_list, 0)) { select_lex->having_fix_field= 0; goto err; @@ -751,14 +760,24 @@ Item_in_subselect::single_value_transformer(JOIN *join, new Item_func_isnull(isnull)); } item->name= (char *)in_additional_cond; + /* + AND can't be changed during fix_fields() + we can assign select_lex->having here, and pass 0 as last + argument (reference) to fix_fields() + */ select_lex->where= join->conds= and_items(join->conds, item); - if (join->conds->fix_fields(thd, join->tables_list, &join->conds)) + if (join->conds->fix_fields(thd, join->tables_list, 0)) goto err; } else { if (select_lex->master_unit()->first_select()->next_select()) { + /* + comparison functions can't be changed during fix_fields() + we can assign select_lex->having here, and pass 0 as last + argument (reference) to fix_fields() + */ select_lex->having= join->having= func->create(expr, @@ -767,7 +786,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, (char *)"<result>")); select_lex->having_fix_field= 1; if (join->having->fix_fields(thd, join->tables_list, - &join->having)) + 0)) { select_lex->having_fix_field= 0; goto err; @@ -880,9 +899,14 @@ Item_in_subselect::row_value_transformer(JOIN *join) select_lex->group_list.first || !select_lex->table_list.elements) { + /* + AND can't be changed during fix_fields() + we can assign select_lex->having here, and pass 0 as last + argument (reference) to fix_fields() + */ select_lex->having= join->having= and_items(join->having, item); select_lex->having_fix_field= 1; - if (join->having->fix_fields(thd, join->tables_list, &join->having)) + if (join->having->fix_fields(thd, join->tables_list, 0)) { select_lex->having_fix_field= 0; goto err; @@ -891,8 +915,13 @@ Item_in_subselect::row_value_transformer(JOIN *join) } else { + /* + AND can't be changed during fix_fields() + we can assign select_lex->having here, and pass 0 as last + argument (reference) to fix_fields() + */ select_lex->where= join->conds= and_items(join->conds, item); - if (join->conds->fix_fields(thd, join->tables_list, &join->having)) + if (join->conds->fix_fields(thd, join->tables_list, 0)) goto err; } if (stmt) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 55ba6abc06b..387f90d2539 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -697,6 +697,8 @@ static bool mysql_test_upd_fields(Prepared_statement *stmt, // this memory pool was opened in open_and_lock_tables thd->ps_setup_free_memory(); DBUG_RETURN(1); + } + if (setup_tables(table_list) || setup_fields(thd, 0, table_list, fields, 1, 0, 0) || setup_conds(thd, table_list, &conds) || thd->net.report_error) |