diff options
| -rw-r--r-- | mysql-test/r/gis-precise.result | 3 | ||||
| -rw-r--r-- | mysql-test/t/gis-precise.test | 3 | ||||
| -rw-r--r-- | sql/item_geofunc.cc | 12 |
3 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result index b60ec2e2e8d..48c00c4a468 100644 --- a/mysql-test/r/gis-precise.result +++ b/mysql-test/r/gis-precise.result @@ -209,3 +209,6 @@ astext(ST_UNION ( PolyFromText('POLYGON(( 2 2 ,3 2,2 7,2 2),( 0 0,8 2,1 9,0 0))'), ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))'))))) GEOMETRYCOLLECTION(POLYGON((0 0,1 9,8 2,0 0),(2 2,2 7,3 2,2 2)),LINESTRING(0 0,5 0,5 1.25),LINESTRING(0 0,0 5,0.555555555555556 5),LINESTRING(2.4 5,2 5)) +SELECT astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0)); +astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0)) +LINESTRING(0 0,1 1) diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test index b5c54c6b0c4..e75316a0805 100644 --- a/mysql-test/t/gis-precise.test +++ b/mysql-test/t/gis-precise.test @@ -111,3 +111,6 @@ SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) SELECT astext(ST_UNION ( PolyFromText('POLYGON(( 2 2 ,3 2,2 7,2 2),( 0 0,8 2,1 9,0 0))'), ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))'))))); + +#bug 801189 ST_BUFFER asserts if radius = 0 +SELECT astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0)); diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 9432de95182..f65df790dfb 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -1406,6 +1406,18 @@ String *Item_func_buffer::val_str(String *str_value) !(g= Geometry::construct(&buffer, obj->ptr(), obj->length()))) goto mem_error; + /* + If the distance given is 0, the Buffer function is in fact NOOP, + so it's natural just to return the argument1. + Besides, internal calculations here can't handle zero distance anyway. + */ + if (fabs(dist) < GIS_ZERO) + { + null_value= 0; + str_result= obj; + goto mem_error; + } + if (func.reserve_op_buffer(2)) goto mem_error; /* will specify operands later */ |
