From 9438c2ca766a176d9b03ebdba466bef37c6e1b40 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2004 18:10:07 +0200 Subject: reporting empty result added in case of max/min optimisation of ALL/ANY/SOME subqueries fixed null processing in NOT operation used in ALL subquery (Bug #6247) mysql-test/r/subselect.result: new tests of ALL/ANY wiews mysql-test/t/subselect.test: new tests of ALL/ANY wiews sql/item_cmpfunc.cc: fixed special NOT ALL processing fixed processing max/min optimized subqueries with empty results (added methods to detect empty results) and special NOP operation to process them for SOME/ANY sobqueries sql/item_cmpfunc.h: fixed processing max/min optimized subqueries with empty results (added methods to detect empty results) and special NOP operation to process them for SOME/ANY sobqueries sql/item_subselect.cc: reporting empty result added for max/min subqueries sql/item_subselect.h: reporting empty result added for max/min subqueries sql/item_sum.cc: reporting empty result added fox max/min aggregate functions sql/item_sum.h: reporting empty result added fox max/min aggregate functions sql/sql_class.cc: reporting empty result added for max/min subqueries sql/sql_parse.cc: reporting empty result added for max/min subqueries sql/sql_union.cc: reporting empty result added for max/min subqueries --- sql/item_sum.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sql/item_sum.cc') diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 3b3a6083725..cf07e136034 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -540,9 +540,22 @@ void Item_sum_hybrid::cleanup() DBUG_ENTER("Item_sum_hybrid::cleanup"); Item_sum::cleanup(); used_table_cache= ~(table_map) 0; + /* + by default is is TRUE to avoid TRUE reporting by + Item_func_not_all/Item_func_nop_all if this item was never called. + + no_rows_in_result() set it to FALSE if was not results found. + */ + was_values= TRUE; DBUG_VOID_RETURN; } +void Item_sum_hybrid::no_rows_in_result() +{ + Item_sum::no_rows_in_result(); + was_values= FALSE; +} + Item *Item_sum_min::copy_or_same(THD* thd) { -- cgit v1.2.1 From 86f19614e1c07b1e3e540d082c137edad80b9f44 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Dec 2004 21:18:15 +0200 Subject: postreview fix sql/item_cmpfunc.cc: comment fixed sql/item_subselect.cc: comment fixed debug info and inherited method call sql/item_subselect.h: comment fixed sql/item_sum.cc: comment fixed sql/item_sum.h: comment fixed --- sql/item_sum.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/item_sum.cc') diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 7bc70052920..66d4fba205c 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -537,11 +537,13 @@ void Item_sum_hybrid::cleanup() DBUG_ENTER("Item_sum_hybrid::cleanup"); Item_sum::cleanup(); used_table_cache= ~(table_map) 0; + /* - by default is is TRUE to avoid TRUE reporting by + by default it is TRUE to avoid TRUE reporting by Item_func_not_all/Item_func_nop_all if this item was never called. no_rows_in_result() set it to FALSE if was not results found. + If some results found it will be left unchanged. */ was_values= TRUE; DBUG_VOID_RETURN; -- cgit v1.2.1 From 8322eb0aaaf410819da5eaa95ecd5e3b6ce3c2b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Dec 2004 03:36:19 +0300 Subject: * Added comments and one assert * Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/item.cc: * More comments * Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/item.h: Assert added sql/item_cmpfunc.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/item_func.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/item_strfunc.h: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/item_subselect.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/item_sum.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/set_var.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/sql_base.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/sql_handler.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/sql_help.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() sql/sql_select.cc: Backport of safety measures from 5.0: make numeorous replaces: s/item->fix_fields()/if (!item->fixed) item->fix_fields() --- sql/item_sum.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/item_sum.cc') diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 66d4fba205c..029a1fd6c48 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1918,7 +1918,9 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) for (i=0 ; i < arg_count ; i++) { - if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1)) + if ((!args[i]->fixed && + args[i]->fix_fields(thd, tables, args + i)) || + args[i]->check_cols(1)) return 1; if (i < arg_count_field) maybe_null|= args[i]->maybe_null; -- cgit v1.2.1