summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2017-03-14 16:35:39 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2017-03-14 16:35:39 +0400
commitd0e8b427a1877392f3b90e00f2c7606608bac996 (patch)
treea4a0f7a01e3c1d0556414a2ac66467a50993998f /sql/opt_range.cc
parent7c7c0696e7eba3717a592c7c2c28c46af26e3e68 (diff)
downloadmariadb-git-d0e8b427a1877392f3b90e00f2c7606608bac996.tar.gz
MDEV-12078 Using spatial index changes type from point to geometry
In get_mm_tree we have to change Field_geom::geom_type to GEOMETRY as we have to let storing all types of the spatial features in the field. So now we restore the original geom_type as it's done.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 61fe64c3930..397ce6f7ecc 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7291,8 +7291,10 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table);
#ifdef HAVE_SPATIAL
+ Field::geometry_type sav_geom_type;
if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
{
+ sav_geom_type= ((Field_geom*) field_item->field)->geom_type;
/* We have to be able to store all sorts of spatial features here */
((Field_geom*) field_item->field)->geom_type= Field::GEOM_GEOMETRY;
}
@@ -7323,6 +7325,13 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
}
}
}
+
+#ifdef HAVE_SPATIAL
+ if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
+ {
+ ((Field_geom*) field_item->field)->geom_type= sav_geom_type;
+ }
+#endif /*HAVE_SPATIAL*/
DBUG_RETURN(ftree);
}