From f1a15ff2c9f6a341d3c528c162157397fbbf3d95 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Mon, 21 May 2012 09:41:04 +0000 Subject: [PATCH] ST_CollectionExtract: inconsistent EMPTY results (#1778) git-svn-id: http://svn.osgeo.org/postgis/trunk@9764 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/lwgeom_functions_basic.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index 2e31c57da..fd8556748 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -2558,13 +2558,12 @@ Datum ST_CollectionExtract(PG_FUNCTION_ARGS) /* Non-collections of the matching type go back */ if(lwgeom_type == type) { - lwgeom_free(lwgeom); - PG_RETURN_POINTER(input); + lwcol = lwgeom_as_multi(lwgeom); } /* Others go back as EMPTY */ else { - lwcol = lwgeom_construct_empty(type, lwgeom->srid, FLAGS_GET_Z(lwgeom->flags), FLAGS_GET_M(lwgeom->flags)); + lwcol = lwgeom_as_multi(lwgeom_construct_empty(type, lwgeom->srid, FLAGS_GET_Z(lwgeom->flags), FLAGS_GET_M(lwgeom->flags))); } } else @@ -2572,13 +2571,6 @@ Datum ST_CollectionExtract(PG_FUNCTION_ARGS) lwcol = lwcollection_as_lwgeom(lwcollection_extract((LWCOLLECTION*)lwgeom, type)); } -#if 0 - if (lwgeom_is_empty(lwcollection_as_lwgeom(lwcol))) - { - lwgeom_free(lwgeom); - PG_RETURN_NULL(); - } -#endif output = geometry_serialize((LWGEOM*)lwcol); lwgeom_free(lwgeom); lwgeom_free(lwcol); -- 2.40.0