[Commits] 6cc133df12b: MDEV-16695: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with
revision-id: 6cc133df12b0805e53dfeba09a277ca4dc3fbd77 (mariadb-10.1.34-45-g6cc133df12b) parent(s): ef25cbea8ec8cbd23f281890ad60136707db9608 author: Varun Gupta committer: Varun Gupta timestamp: 2018-08-18 01:02:20 +0530 message: MDEV-16695: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with optimizer_use_condition_selectivity>=3 Selectivity analysis should be disabled for Geometrical columns for the case like geometric_field= string_constant. --- mysql-test/r/gis.result | 16 ++++++++++++++++ mysql-test/t/gis.test | 16 ++++++++++++++++ sql/opt_range.cc | 6 ++++++ 3 files changed, 38 insertions(+) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 76f4f6accdb..e12b4a0d0fb 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1861,3 +1861,19 @@ t2 CREATE TABLE `t2` ( `w2` int(1) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; +# +# MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +# optimizer_use_condition_selectivity>=3 +# +CREATE TABLE t1 (a POINT); +INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3)); +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=3; +SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1'); +COUNT(*) +0 +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index ca43e8d4e2f..80edad21c81 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1553,3 +1553,19 @@ CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL); CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1,t2; + +--echo # +--echo # MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +--echo # optimizer_use_condition_selectivity>=3 +--echo # + +CREATE TABLE t1 (a POINT); +INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3)); +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=3; +SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1'); +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 1e29efda0d1..2255c9a2fe6 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -7607,6 +7607,12 @@ Item_bool_func::get_mm_parts(RANGE_OPT_PARAM *param, Field *field, if (field->table != param->table) DBUG_RETURN(0); + #ifdef HAVE_SPATIAL + if (type == Item_func::EQ_FUNC && field->type() == MYSQL_TYPE_GEOMETRY + && value->const_item() && value->type() == Item::STRING_ITEM) + DBUG_RETURN(NULL); + #endif + KEY_PART *key_part = param->key_parts; KEY_PART *end = param->key_parts_end; SEL_TREE *tree=0;
participants (1)
-
Varun