summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-04-10 18:07:29 -0700
committerIgor Babaev <igor@askmonty.org>2018-04-10 18:07:29 -0700
commit740fc2ae084f8f81990de557d696aefbc507752d (patch)
treeac20fe4974df67d667d76faa81a21fe17c1bd134 /mysql-test
parent45e6d0aebf023acb50671f82b87e6de5d1e78f5e (diff)
downloadmariadb-git-740fc2ae084f8f81990de557d696aefbc507752d.tar.gz
Fixed mdev-15765 BETWEEN not working in certain cases
The implementations of the convert_to_basic_const_item() virtual function for the Item_cache classes should call cache_value() when value_cached == NULL.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/derived_cond_pushdown.result15
-rw-r--r--mysql-test/t/derived_cond_pushdown.test13
2 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index e30bd4c4fe6..8e74e093a4a 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -9030,3 +9030,18 @@ EXPLAIN
}
}
DROP TABLE t1,t2;
+#
+# MDEV-15765: pushing condition with temporal constants
+# into constant tables
+#
+select * from (select date('2018-01-01') as d
+union all
+select date('2018-01-01') as d) as t
+where t.d between date ('2017-01-01') and date ('2019-01-01');
+d
+2018-01-01
+2018-01-01
+select * from (select date('2018-01-01') as d) as t
+where t.d between date ('2017-01-01') and date ('2019-01-01');
+d
+2018-01-01
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index b1555fd7a02..0b87738a727 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -1633,3 +1633,16 @@ EVAL EXPLAIN $query;
EVAL EXPLAIN FORMAT=JSON $query;
DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-15765: pushing condition with temporal constants
+--echo # into constant tables
+--echo #
+
+select * from (select date('2018-01-01') as d
+ union all
+ select date('2018-01-01') as d) as t
+ where t.d between date ('2017-01-01') and date ('2019-01-01');
+
+select * from (select date('2018-01-01') as d) as t
+ where t.d between date ('2017-01-01') and date ('2019-01-01');