diff --git a/mysql-test/main/spatial_utility_function_validate.result b/mysql-test/main/spatial_utility_function_validate.result index 5761f0dbfb7..e5d28c8470c 100644 --- a/mysql-test/main/spatial_utility_function_validate.result +++ b/mysql-test/main/spatial_utility_function_validate.result @@ -134,3 +134,6 @@ SELECT ST_ASTEXT(ST_VALIDATE( ST_GEOMFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 should_be_null; should_be_null NULL +SELECT ST_ASTEXT(ST_VALIDATE(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION( POLYGON( ( 5 2, 4 3, 9 8, 2 9, 1 6, 3 1, 3 1, 5 2 ) ), LINESTRING( 8 5, 0 3, 4 9, 1 8, 0 8, 5 2 ), POINT( 7 7 ), LINESTRING( 0 1, 1 6, 7 2, 3 4 ), LINESTRING( 5 2, 9 9, 4 4, 7 5, 4 6 ) ) '))) a; +a +GEOMETRYCOLLECTION(POLYGON((5 2,4 3,9 8,2 9,1 6,3 1,3 1,5 2)),LINESTRING(8 5,0 3,4 9,1 8,0 8,5 2),POINT(7 7),LINESTRING(0 1,1 6,7 2,3 4),LINESTRING(5 2,9 9,4 4,7 5,4 6)) diff --git a/mysql-test/main/spatial_utility_function_validate.test b/mysql-test/main/spatial_utility_function_validate.test index e3660049177..fd112a790a1 100644 --- a/mysql-test/main/spatial_utility_function_validate.test +++ b/mysql-test/main/spatial_utility_function_validate.test @@ -99,3 +99,5 @@ should_be_null; SELECT ST_ASTEXT(ST_VALIDATE( ST_GEOMFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0),( 0.25 0.25, 1.75 0.25, 0.75 0.75, 0.25 0.75, 0.25 0.25))',4326))) AS should_be_null; + +SELECT ST_ASTEXT(ST_VALIDATE(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION( POLYGON( ( 5 2, 4 3, 9 8, 2 9, 1 6, 3 1, 3 1, 5 2 ) ), LINESTRING( 8 5, 0 3, 4 9, 1 8, 0 8, 5 2 ), POINT( 7 7 ), LINESTRING( 0 1, 1 6, 7 2, 3 4 ), LINESTRING( 5 2, 9 9, 4 4, 7 5, 4 6 ) ) '))) a; diff --git a/sql/spatial.cc b/sql/spatial.cc index f924059a35d..f41b30f57ff 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -4604,6 +4604,7 @@ int Gis_geometry_collection::make_clockwise(String *result) const !(geometry= Geometry::construct(&buffer, wkb.ptr(), wkb.length()))) return 1; + result->reserve(sizeof(char) + sizeof(uint32)); result->q_append((char) wkb_ndr); result->q_append((uint32) geometry->get_class_info()->m_type_id); if (geometry->get_class_info()->m_type_id == Geometry::wkb_polygon ||