[SCM] PostGIS branch stable-3.2 updated. 3.2.7-4-gbd10d04c5

git at osgeo.org git at osgeo.org
Mon Feb 26 11:33:41 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.2 has been updated
       via  bd10d04c5ef7d55e0b7e35f7517da68a87e095f7 (commit)
      from  c90e28232af39b95996fd5e0680de0559a756b75 (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 bd10d04c5ef7d55e0b7e35f7517da68a87e095f7
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Feb 26 11:33:26 2024 -0800

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

diff --git a/NEWS b/NEWS
index 64b226c07..3d3749616 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PostGIS 3.2.8
 
 * Bug Fixes  *
 
+ - #5677, ST_Union(geom[]) should unary union single entry arrays (Paul Ramsey)
 
 
 PostGIS 3.2.7
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index a73c6aa0d..0c117973d 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -518,6 +518,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 )
 	{
@@ -525,15 +528,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