summaryrefslogtreecommitdiff
path: root/sql/opt_table_elimination.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-11-18 16:33:29 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-11-18 16:33:29 +0400
commite52b1637e0d59d3a4368fe2ce3a41c47d4041c2a (patch)
treecb9dcc3b2aec21fc88ec42106be0c3330de214f0 /sql/opt_table_elimination.cc
parent807934d08345c69ae31e0a0a1fcf7c92431d6204 (diff)
downloadmariadb-git-e52b1637e0d59d3a4368fe2ce3a41c47d4041c2a.tar.gz
MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns
MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns Disallow using indexes on non-temporal columns to optimize ref access, range access and table elimination when the counterpart's cmp_type is TIME_RESULT, e.g.: SELECT * FROM t1 WHERE indexed_int_column=time_expression; Only index on a temporal column can be used to optimize temporal comparison operations.
Diffstat (limited to 'sql/opt_table_elimination.cc')
-rw-r--r--sql/opt_table_elimination.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index 2ef565517b5..9c10790f9c0 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -1486,6 +1486,8 @@ void check_equality(Dep_analysis_context *ctx, Dep_module_expr **eq_mod,
left->real_item()->type() == Item::FIELD_ITEM)
{
Field *field= ((Item_field*)left->real_item())->field;
+ if (right->cmp_type() == TIME_RESULT && field->cmp_type() != TIME_RESULT)
+ return;
if (field->result_type() == STRING_RESULT)
{
if (right->result_type() != STRING_RESULT)