1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

do not try to use equal field from outer query as field of local join (BUG#6384)

mysql-test/r/subselect.result:
  changes in plans
  test for bug#6384
mysql-test/t/subselect.test:
  test for bug#6384
sql/sql_select.cc:
  do not set equal field from outer query
This commit is contained in:
unknown
2005-05-20 16:01:41 +03:00
parent 3034935a87
commit 648b072da2
3 changed files with 25 additions and 7 deletions

View File

@ -6381,7 +6381,9 @@ static bool check_equality(Item *item, COND_EQUAL *cond_equal)
Item *left_item= ((Item_func*) item)->arguments()[0];
Item *right_item= ((Item_func*) item)->arguments()[1];
if (left_item->type() == Item::FIELD_ITEM &&
right_item->type() == Item::FIELD_ITEM)
right_item->type() == Item::FIELD_ITEM &&
!((Item_field*)left_item)->depended_from &&
!((Item_field*)right_item)->depended_from)
{
/* The predicate the form field1=field2 is processed */
@ -6460,13 +6462,15 @@ static bool check_equality(Item *item, COND_EQUAL *cond_equal)
/* The predicate of the form field=const/const=field is processed */
Item *const_item= 0;
Item_field *field_item= 0;
if (left_item->type() == Item::FIELD_ITEM &&
if (left_item->type() == Item::FIELD_ITEM &&
!((Item_field*)left_item)->depended_from &&
right_item->const_item())
{
field_item= (Item_field*) left_item;
const_item= right_item;
}
else if (right_item->type() == Item::FIELD_ITEM &&
else if (right_item->type() == Item::FIELD_ITEM &&
!((Item_field*)right_item)->depended_from &&
left_item->const_item())
{
field_item= (Item_field*) right_item;