Commit ca5473f1 authored by unknown's avatar unknown

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.
parent afedd72e
...@@ -339,3 +339,17 @@ select @a; ...@@ -339,3 +339,17 @@ select @a;
@a @a
0111-01-01 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;
...@@ -317,3 +317,13 @@ set @a=(select min(makedate('111','1'))) ; ...@@ -317,3 +317,13 @@ set @a=(select min(makedate('111','1'))) ;
select @a; select @a;
--echo # --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;
...@@ -3889,7 +3889,6 @@ class Item_cache: public Item_basic_constant ...@@ -3889,7 +3889,6 @@ class Item_cache: public Item_basic_constant
bool is_null() { return null_value; } bool is_null() { return null_value; }
virtual bool is_expensive() virtual bool is_expensive()
{ {
DBUG_ASSERT(example);
if (value_cached) if (value_cached)
return false; return false;
return example->is_expensive(); return example->is_expensive();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment