summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@host.loc>2008-03-14 23:11:59 +0400
committerunknown <gshchepa/uchum@host.loc>2008-03-14 23:11:59 +0400
commit9699767c952bf30ab4b18a15e131ba417745f855 (patch)
treed53378ce27e73d046ddcaf757b7f548bddd99066 /sql/item_subselect.cc
parent4fa1c9e950dc9691c92ade5fecc6e9d5a65b4c97 (diff)
downloadmariadb-git-9699767c952bf30ab4b18a15e131ba417745f855.tar.gz
Fixed bug #34763.
Queries like: SELECT ROW(1, 2) IN (SELECT t1.a, 2) FROM t1 GROUP BY t1.a or SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a lead to assertion failure in the Item_in_subselect::row_value_transformer method in debugging build, or to unexpected error message in release build: ERROR 1247 (42S22): Reference '<list ref>' not supported (forward reference in item list) Unexpected error message and assertion failure have been eliminated. mysql-test/r/subselect3.result: Added test case for bug #34763. mysql-test/t/subselect3.test: Added test case for bug #34763. sql/item.cc: Fixed bug #34763. The Item_ref::fix_fields method has been modified to silently ignore not fixed outer references: by the definition, those references should be fixed later by the call to the fix_inner_refs function. sql/item_subselect.cc: Fixed bug #34763. The Item_in_subselect::row_value_transformer method has been modified to eliminate assertion failure on not fixed outer references: by the definition those references are allowed in this context and should be fixed later by the call to the fix_inner_refs function.
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index b3710841dfb..a03a7d739b2 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1232,7 +1232,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);
@@ -1306,7 +1310,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);