summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@host.loc>2008-03-20 00:30:37 +0400
committerunknown <gshchepa/uchum@host.loc>2008-03-20 00:30:37 +0400
commiteb2260dff04f73d84ade57d27117ac988025137a (patch)
tree6309fda5239038456a6998831cba162dab2587cc /sql
parent412a42b309990050060f263d06f8d01a8536f324 (diff)
parent9699767c952bf30ab4b18a15e131ba417745f855 (diff)
downloadmariadb-git-eb2260dff04f73d84ade57d27117ac988025137a.tar.gz
Merge host.loc:/home/uchum/work/PA/5.0-opt-34763
into host.loc:/home/uchum/work/5.1-opt mysql-test/r/subselect3.result: Auto merged mysql-test/t/subselect3.test: Auto merged sql/item.cc: Auto merged sql/item_subselect.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc15
-rw-r--r--sql/item_subselect.cc12
2 files changed, 19 insertions, 8 deletions
diff --git a/sql/item.cc b/sql/item.cc
index cfb8f336a91..14360a852bb 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5604,13 +5604,16 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
DBUG_ASSERT(*ref);
/*
Check if this is an incorrect reference in a group function or forward
- reference. Do not issue an error if this is an unnamed reference inside an
- aggregate function.
+ reference. Do not issue an error if this is:
+ 1. outer reference (will be fixed later by the fix_inner_refs function);
+ 2. an unnamed reference inside an aggregate function.
*/
- if (((*ref)->with_sum_func && name &&
- !(current_sel->linkage != GLOBAL_OPTIONS_TYPE &&
- current_sel->having_fix_field)) ||
- !(*ref)->fixed)
+ if (!((*ref)->type() == REF_ITEM &&
+ ((Item_ref *)(*ref))->ref_type() == OUTER_REF) &&
+ (((*ref)->with_sum_func && name &&
+ !(current_sel->linkage != GLOBAL_OPTIONS_TYPE &&
+ current_sel->having_fix_field)) ||
+ !(*ref)->fixed))
{
my_error(ER_ILLEGAL_REFERENCE, MYF(0),
name, ((*ref)->with_sum_func?
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 7b68d258d29..0ccadaf28da 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1288,7 +1288,11 @@ Item_in_subselect::row_value_transformer(JOIN *join)
Item *item_having_part2= 0;
for (uint i= 0; i < cols_num; i++)
{
- DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
+ DBUG_ASSERT(left_expr->fixed &&
+ select_lex->ref_pointer_array[i]->fixed ||
+ (select_lex->ref_pointer_array[i]->type() == REF_ITEM &&
+ ((Item_ref*)(select_lex->ref_pointer_array[i]))->ref_type() ==
+ Item_ref::OUTER_REF));
if (select_lex->ref_pointer_array[i]->
check_cols(left_expr->element_index(i)->cols()))
DBUG_RETURN(RES_ERROR);
@@ -1362,7 +1366,11 @@ Item_in_subselect::row_value_transformer(JOIN *join)
for (uint i= 0; i < cols_num; i++)
{
Item *item, *item_isnull;
- DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
+ DBUG_ASSERT(left_expr->fixed &&
+ select_lex->ref_pointer_array[i]->fixed ||
+ (select_lex->ref_pointer_array[i]->type() == REF_ITEM &&
+ ((Item_ref*)(select_lex->ref_pointer_array[i]))->ref_type() ==
+ Item_ref::OUTER_REF));
if (select_lex->ref_pointer_array[i]->
check_cols(left_expr->element_index(i)->cols()))
DBUG_RETURN(RES_ERROR);