Commit 60131d02 authored by unknown's avatar unknown

fixed bug in HAVING error handling

small Item_ref optimization

parent c37bbf06
...@@ -822,8 +822,9 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) ...@@ -822,8 +822,9 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{ {
if (!ref) if (!ref)
{ {
SELECT_LEX *sl=thd->lex.select->outer_select();
if ((ref= find_item_in_list(this, thd->lex.select->item_list, if ((ref= find_item_in_list(this, thd->lex.select->item_list,
REPORT_EXCEPT_NOT_FOUND)) == (sl ? REPORT_EXCEPT_NOT_FOUND : REPORT_ALL_ERRORS))) ==
(Item **)not_found_item) (Item **)not_found_item)
{ {
/* /*
...@@ -836,9 +837,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) ...@@ -836,9 +837,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
cause error ER_NON_UNIQ_ERROR in find_item_in_list. cause error ER_NON_UNIQ_ERROR in find_item_in_list.
*/ */
SELECT_LEX *last=0; SELECT_LEX *last=0;
for (SELECT_LEX *sl= thd->lex.select->outer_select(); for ( ; sl ; sl= sl->outer_select())
sl;
sl= sl->outer_select())
if((ref= find_item_in_list(this, (last= sl)->item_list, if((ref= find_item_in_list(this, (last= sl)->item_list,
REPORT_EXCEPT_NOT_FOUND)) != REPORT_EXCEPT_NOT_FOUND)) !=
(Item **)not_found_item) (Item **)not_found_item)
...@@ -852,6 +851,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) ...@@ -852,6 +851,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{ {
// Call to report error // Call to report error
find_item_in_list(this, thd->lex.select->item_list, REPORT_ALL_ERRORS); find_item_in_list(this, thd->lex.select->item_list, REPORT_ALL_ERRORS);
ref=0;
return 1; return 1;
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment