Commit 67e93709 authored by Alexey Botchkov's avatar Alexey Botchkov

Fix for bug #804259 Second assertion in Gis_geometry_collection::init_from_opresult.

        A polygon has no right to have holes that are actually points.
        So just skip them when we collect the result of an operation.

per-file comments:
  mysql-test/r/gis-precise.result
Fix for bug #804259 Second assertion in Gis_geometry_collection::init_from_opresult.
        test result updated.
  mysql-test/t/gis-precise.test
Fix for bug #804259 Second assertion in Gis_geometry_collection::init_from_opresult.
        test case added.
  sql/gcalc_tools.cc
Fix for bug #804259 Second assertion in Gis_geometry_collection::init_from_opresult.
        Skip the point in the result if it's the hole inside a polygon.
parent e182ae27
...@@ -265,3 +265,17 @@ Round(ST_AREA(ST_BUFFER( ST_UNION( ...@@ -265,3 +265,17 @@ Round(ST_AREA(ST_BUFFER( ST_UNION(
POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'), POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'),
POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6) POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6)
21.901403 21.901403
SELECT AsText(ST_UNION(MultiPolygonFromText('
MULTIPOLYGON(((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)),
((0 0, 8 3, 7 4, 0 0)),
((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)))'),
MultiPolygonFromText(' MULTIPOLYGON(((0 0, 1 9, 4 6, 0 0)),
((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1)),
((7 7, 4 7, 6 3, 7 2, 7 7)),
((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1))) ')));
AsText(ST_UNION(MultiPolygonFromText('
MULTIPOLYGON(((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)),
((0 0, 8 3, 7 4, 0 0)),
((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)))'),
MultiPolygonFr
POLYGON((0 0,0 5,0.555555555555556 5,1 9,2 8,8 8,8 2,7 2,5.33333333333333 2,3 1.125,3 0,0 0),(1 1,1 1.5,1.33333333333333 2,1 2,2 2,2 1.14285714285714,1.75 1,1 1),(3 1.71428571428571,3 2,3.5 2,3 1.71428571428571),(4 4,4 6,4.5 6,5.5 4,4 4))
...@@ -156,3 +156,15 @@ SELECT ST_NUMGEOMETRIES((ST_UNION(ST_UNION( ...@@ -156,3 +156,15 @@ SELECT ST_NUMGEOMETRIES((ST_UNION(ST_UNION(
SELECT Round(ST_AREA(ST_BUFFER( ST_UNION( SELECT Round(ST_AREA(ST_BUFFER( ST_UNION(
POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'), POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'),
POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6); POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6);
#buf #804259 Second assertion in Gis_geometry_collection::init_from_opresult
SELECT AsText(ST_UNION(MultiPolygonFromText('
MULTIPOLYGON(((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)),
((0 0, 8 3, 7 4, 0 0)),
((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)))'),
MultiPolygonFromText(' MULTIPOLYGON(((0 0, 1 9, 4 6, 0 0)),
((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1)),
((7 7, 4 7, 6 3, 7 2, 7 7)),
((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1))) ')));
...@@ -319,6 +319,11 @@ int Gcalc_result_receiver::complete_shape() ...@@ -319,6 +319,11 @@ int Gcalc_result_receiver::complete_shape()
{ {
if (cur_shape != Gcalc_function::shape_point) if (cur_shape != Gcalc_function::shape_point)
{ {
if (cur_shape == Gcalc_function::shape_hole)
{
buffer.length(shape_pos);
return 0;
}
cur_shape= Gcalc_function::shape_point; cur_shape= Gcalc_function::shape_point;
buffer.length(buffer.length()-4); buffer.length(buffer.length()-4);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment