[SCM] PostGIS branch stable-3.3 updated. 3.3.6-4-gb885f39be

git at osgeo.org git at osgeo.org
Mon Feb 26 11:32:50 PST 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, stable-3.3 has been updated
       via  b885f39bee3be746780737c2517768aee433084c (commit)
      from  662ad692a28e702547b76f222a2406b007486adc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b885f39bee3be746780737c2517768aee433084c
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Feb 26 11:32:37 2024 -0800

    ST_Union(geom[]) should unary union single entry arrays
    References #5677

diff --git a/NEWS b/NEWS
index 8af44332d..f0c8e1e58 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ xxxx/xx/xx
 * Bug Fixes and Enhancements *
 
  - #5649, ST_Value should return NULL on missing band (Paul Ramsey)
+ - #5677, ST_Union(geom[]) should unary union single entry arrays (Paul Ramsey)
 
 
 PostGIS 3.3.6
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index f183fb691..6f78f6060 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -515,6 +515,9 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS)
 	if ( count == 0 )
 		PG_RETURN_NULL();
 
+	/* Ok, we really need GEOS now ;) */
+	initGEOS(lwpgnotice, lwgeom_geos_error);
+
 	/* One geom, good geom? Return it */
 	if ( count == 1 && nelems == 1 )
 	{
@@ -522,15 +525,19 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wsign-compare"
 #endif
-		PG_RETURN_POINTER((GSERIALIZED *)(ARR_DATA_PTR(array)));
+		g = POSTGIS2GEOS((GSERIALIZED *)(ARR_DATA_PTR(array)));
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 #pragma GCC diagnostic pop
 #endif
+		g_union = GEOSUnaryUnion(g);
+		GEOSGeom_destroy(g);
+		if (!g_union) HANDLE_GEOS_ERROR("GEOSUnaryUnion");
+		GEOSSetSRID(g_union, srid);
+		gser_out = GEOS2POSTGIS(g_union, is3d);
+		GEOSGeom_destroy(g_union);
+		PG_RETURN_POINTER(gser_out);
 	}
 
-	/* Ok, we really need GEOS now ;) */
-	initGEOS(lwpgnotice, lwgeom_geos_error);
-
 	/*
 	** Collect the non-empty inputs and stuff them into a GEOS collection
 	*/

-----------------------------------------------------------------------

Summary of changes:
 NEWS                  |  1 +
 postgis/lwgeom_geos.c | 15 +++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list