summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-06-04 18:06:00 +0300
committerunknown <timour@askmonty.org>2012-06-04 18:06:00 +0300
commitca5473f1db6dc63baffc736737e54bdffd6449a6 (patch)
tree35bb3843fbed2cc58639711a3b39d89618aaa692
parentafedd72e225654225b20a91b072b012e4c57a9d4 (diff)
downloadmariadb-git-ca5473f1db6dc63baffc736737e54bdffd6449a6.tar.gz
Fix bug lp:1008487
Analysis: The crash is a result of Item_cache_temporal::example not being set (it is NULL). It turns out that the value of Item_cache_temporal may be set directly by calling Item_cache_temporal::store_packed without ever setting the "example" of this Item_cache. Therefore the failing assertion is too narrow. Solution: Remove the assert. In principle we could overwrite this method for Item_cache_temporal, but it doesn't make sense just for this assert.
-rw-r--r--mysql-test/r/type_date.result14
-rw-r--r--mysql-test/t/type_date.test10
-rw-r--r--sql/item.h1
3 files changed, 24 insertions, 1 deletions
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index fbac1752c37..41f590400ea 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -339,3 +339,17 @@ select @a;
@a
0111-01-01
#
+#
+# BUG LP:1008487 virtual bool Item_cache::is_expensive(): Assertion `example' failed
+#
+create table t1(a date,key(a));
+insert into t1 values ('2012-01-01'),('2012-02-02');
+explain
+select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1_0 ref a a 4 const 0 Using where; Using index
+1 SIMPLE t2 index NULL a 4 NULL 2 Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t1 index NULL a 4 NULL 2 Using index; Using join buffer (incremental, BNL join)
+select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
+1
+drop table t1;
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 52895951787..3129863ab9b 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -317,3 +317,13 @@ set @a=(select min(makedate('111','1'))) ;
select @a;
--echo #
+--echo #
+--echo # BUG LP:1008487 virtual bool Item_cache::is_expensive(): Assertion `example' failed
+--echo #
+create table t1(a date,key(a));
+insert into t1 values ('2012-01-01'),('2012-02-02');
+explain
+select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
+select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
+drop table t1;
+
diff --git a/sql/item.h b/sql/item.h
index b3801e6c488..a9c1153d236 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3889,7 +3889,6 @@ public:
bool is_null() { return null_value; }
virtual bool is_expensive()
{
- DBUG_ASSERT(example);
if (value_cached)
return false;
return example->is_expensive();