diff options
-rw-r--r-- | mysql-test/r/partition.result | 12 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 13 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 1bc1ea31671..431c5dda116 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -2461,3 +2461,15 @@ SELECT 1 FROM t1 JOIN t1 AS t2 USING (a); 1 1 drop table t1; +# +# LP BUG#1001117 Crash on a simple select that uses a temptable view +# MySQL Bug #12330344 Crash and/or valgrind errors in free_io_cache with join, view, +# partitioned table +# +CREATE TABLE t1(a INT PRIMARY KEY) PARTITION BY LINEAR KEY (a); +CREATE ALGORITHM=TEMPTABLE VIEW vtmp AS +SELECT 1 FROM t1 AS t1_0 JOIN t1 ON t1_0.a LIKE (SELECT 1 FROM t1); +SELECT * FROM vtmp; +1 +DROP VIEW vtmp; +DROP TABLE t1; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index d6d49c59255..08c028c8224 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -2463,3 +2463,16 @@ INSERT INTO t1 VALUES (6,8,10); SELECT 1 FROM t1 JOIN t1 AS t2 USING (a); drop table t1; + +--echo # +--echo # LP BUG#1001117 Crash on a simple select that uses a temptable view +--echo # MySQL Bug #12330344 Crash and/or valgrind errors in free_io_cache with join, view, +--echo # partitioned table +--echo # + +CREATE TABLE t1(a INT PRIMARY KEY) PARTITION BY LINEAR KEY (a); +CREATE ALGORITHM=TEMPTABLE VIEW vtmp AS +SELECT 1 FROM t1 AS t1_0 JOIN t1 ON t1_0.a LIKE (SELECT 1 FROM t1); +SELECT * FROM vtmp; +DROP VIEW vtmp; +DROP TABLE t1; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index b45b138ced2..560373b69e6 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4736,7 +4736,7 @@ longlong Item_func_like::val_int() Item_func::optimize_type Item_func_like::select_optimize() const { - if (args[1]->const_item()) + if (args[1]->const_item() && !args[1]->is_expensive()) { String* res2= args[1]->val_str((String *)&cmp.value2); const char *ptr2; |