summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2012-08-31 19:50:45 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2012-08-31 19:50:45 +0500
commit589c62fefec759a467b6dec1badb2cd283564845 (patch)
treeda5dfea16b6d6aa9c348daa31237bc923a4591e0 /sql
parent51e14492e9410718056b0c6d9d4dabd4a96e8070 (diff)
downloadmariadb-git-589c62fefec759a467b6dec1badb2cd283564845.tar.gz
Bug #1043845 st_distance() results are incorrect depending on variable order.
Autointersections of an object were treated as nodes, so the wrong result. per-file comments: mysql-test/r/gis.result Bug #1043845 st_distance() results are incorrect depending on variable order. test result updated. mysql-test/t/gis.test Bug #1043845 st_distance() results are incorrect depending on variable order. test case added. sql/item.cc small fix to make compilers happy. sql/item_geofunc.cc Bug #1043845 st_distance() results are incorrect depending on variable order. Skip intersection points when calculate distance.
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item_geofunc.cc3
2 files changed, 3 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index e125e57d2fc..bb6360f3f73 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -8858,7 +8858,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
item->max_length, item->decimals));
fld_type= Field::field_type_merge(fld_type, get_real_type(item));
{
- int item_decimals= item->decimals;
+ uint item_decimals= item->decimals;
/* fix variable decimals which always is NOT_FIXED_DEC */
if (Field::result_merge_type(fld_type) == INT_RESULT)
item_decimals= 0;
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 172e0cbcd1f..522be28558f 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1693,7 +1693,8 @@ count_distance:
for (dist_point= collector.get_first(); dist_point; dist_point= dist_point->get_next())
{
/* We only check vertices of object 2 */
- if (dist_point->shape < obj2_si)
+ if (dist_point->type != Gcalc_heap::nt_shape_node ||
+ dist_point->shape < obj2_si)
continue;
/* if we have an edge to check */