LPBUG#523593: Running RQG optimizer_no_subquery crashes MariaDB

- When analying multiple equalities, take into account that they 
  may not have a single table field that belongs to one of the tables
  that we're trying to eliminate (and they are not useful for table
  elimination in that case)

mysql-test/r/table_elim.result:
  LPBUG#523593: Running RQG optimizer_no_subquery crashes MariaDB
  - Testcase
mysql-test/t/table_elim.test:
  LPBUG#523593: Running RQG optimizer_no_subquery crashes MariaDB
  - Testcase
This commit is contained in:
Sergey Petrunya 2010-02-18 15:03:52 +03:00
commit 69028d5127
3 changed files with 107 additions and 2 deletions

View file

@ -1220,8 +1220,16 @@ void build_eq_mods_for_cond(Dep_analysis_context *ctx,
bound_item= item;
}
}
exchange_sort<Dep_value_field>(fvl, compare_field_values, NULL);
add_module_expr(ctx, eq_mod, *and_level, NULL, bound_item, fvl);
/*
Multiple equality is only useful if it includes at least one field from
the table that we could potentially eliminate:
*/
if (fvl->elements)
{
exchange_sort<Dep_value_field>(fvl, compare_field_values, NULL);
add_module_expr(ctx, eq_mod, *and_level, NULL, bound_item, fvl);
}
break;
}
default: