summaryrefslogtreecommitdiff
path: root/sql/opt_table_elimination.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2010-02-18 15:03:52 +0300
committerSergey Petrunya <psergey@askmonty.org>2010-02-18 15:03:52 +0300
commit69028d5127fcf964c5ab09f0b84ff9780a3326ad (patch)
tree537ade321ada897fb93f651ffe07192bdc0d6c3d /sql/opt_table_elimination.cc
parent6e7241caa52151a9cd1a8e5648bd3e8bf6ce973c (diff)
downloadmariadb-git-69028d5127fcf964c5ab09f0b84ff9780a3326ad.tar.gz
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
Diffstat (limited to 'sql/opt_table_elimination.cc')
-rw-r--r--sql/opt_table_elimination.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index ef2a92f1797..5d952021365 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -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: