Commit b89eb41a authored by Sandro Santilli's avatar Sandro Santilli

Alwas return NULL on type miss from ST_CollectionExtract (#835)

git-svn-id: http://svn.osgeo.org/postgis/trunk@8718 b70326c6-7e19-0410-871a-916f4a2858ee
parent 8f99c827
......@@ -2539,6 +2539,12 @@ Datum ST_CollectionExtract(PG_FUNCTION_ARGS)
}
lwcol = lwcollection_extract((LWCOLLECTION*)lwgeom, type);
if (lwgeom_is_empty(lwcollection_as_lwgeom(lwcol)))
{
lwgeom_free(lwgeom);
PG_RETURN_NULL();
}
output = geometry_serialize((LWGEOM*)lwcol);
lwgeom_free(lwgeom);
......
......@@ -177,7 +177,7 @@ HINT: "MULTIPOINT(1 1, 2 2" <-- parse error at position 19 within geometry
156|MULTIPOINT(1 1)
157|MULTILINESTRING((0 0,1 1))
158|MULTILINESTRING((0 0,1 1),(2 2,3 3))
159|GEOMETRYCOLLECTION EMPTY
159|
160|MULTIPOINT(1 1)
161|MULTILINESTRING((0 0,1 1),(2 2,3 3))
ERROR: Input geometries must be points
......
......@@ -297,6 +297,20 @@ SELECT '#457.7', st_astext(st_collectionExtract('POLYGON((0 0, 1 0, 1 1, 0 1, 0
SELECT '#457.8', st_astext(st_collectionExtract('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))', 2));
SELECT '#457.9', st_astext(st_collectionExtract('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))', 3));
-- #835 --
SELECT '#835.1', st_astext(st_collectionExtract('POLYGON EMPTY', 1));
SELECT '#835.2', st_astext(st_collectionExtract('POLYGON EMPTY', 2));
SELECT '#835.3', st_astext(st_collectionExtract('POLYGON EMPTY', 3));
SELECT '#835.4', st_astext(st_collectionExtract('LINESTRING EMPTY', 1));
SELECT '#835.5', st_astext(st_collectionExtract('LINESTRING EMPTY', 2));
SELECT '#835.6', st_astext(st_collectionExtract('LINESTRING EMPTY', 3));
SELECT '#835.7', st_astext(st_collectionExtract('POINT EMPTY', 1));
SELECT '#835.8', st_astext(st_collectionExtract('POINT EMPTY', 2));
SELECT '#835.9', st_astext(st_collectionExtract('POINT EMPTY', 3));
SELECT '#835.10', st_astext(st_collectionExtract('GEOMETRYCOLLECTION EMPTY', 1));
SELECT '#835.11', st_astext(st_collectionExtract('GEOMETRYCOLLECTION EMPTY', 2));
SELECT '#835.12', st_astext(st_collectionExtract('GEOMETRYCOLLECTION EMPTY', 3));
-- #650 --
SELECT '#650', ST_AsText(ST_Collect(ARRAY[ST_MakePoint(0,0), ST_MakePoint(1,1), null, ST_MakePoint(2,2)]));
......
......@@ -81,6 +81,18 @@ NOTICE: IllegalArgumentException: Invalid number of points in LinearRing found
#457.7|
#457.8|
#457.9|POLYGON((0 0,1 0,1 1,0 1,0 0))
#835.1|
#835.2|
#835.3|POLYGON EMPTY
#835.4|
#835.5|LINESTRING EMPTY
#835.6|
#835.7|POINT EMPTY
#835.8|
#835.9|
#835.10|
#835.11|
#835.12|
#650|MULTIPOINT(0 0,1 1,2 2)
#667|SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,18.2842712474619 11.7157287525381,-9.99999999999994 0,-38.284271247462 68.2842712474618,30 40))
#677|1121395
......
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