[SCM] PostGIS branch stable-3.5 updated. 3.5.3-29-gb2cb17fa0

git at osgeo.org git at osgeo.org
Fri Jul 11 12:56:36 PDT 2025


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.5 has been updated
       via  b2cb17fa069861f658d80d67ce34f98a354e23fd (commit)
      from  0dfc6a2c78a0c7c0d55050ef6520c0614301da84 (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 b2cb17fa069861f658d80d67ce34f98a354e23fd
Author: Paul Ramsey <paul.ramsey at snowflake.com>
Date:   Fri Jul 11 12:56:16 2025 -0700

    Fix bug in reading geometry type off head of
    serialization in ST_IsCollection. References #5927

diff --git a/NEWS b/NEWS
index 7fe28b550..b6dd7201d 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ PostgreSQL 12-18 required. GEOS 3.8+ required. Proj 6.1+ required.
          and switch to GDALGetDataTypeSizeBytes (Laurențiu Nicola)
 - GT-257, fix issue with xsltproc with path has spaces (Laurențiu Nicola)
 - #5939, incorrect parameter order in ST_Relate caching (Paul Ramsey)
+- #5927, ST_IsCollection throwing exception (Paul Ramsey)
 
 
 PostGIS 3.5.3
diff --git a/liblwgeom/liblwgeom.h.in b/liblwgeom/liblwgeom.h.in
index f8c11405c..ee9b7d8c0 100644
--- a/liblwgeom/liblwgeom.h.in
+++ b/liblwgeom/liblwgeom.h.in
@@ -906,6 +906,7 @@ extern int lwgeom_is_collection(const LWGEOM *lwgeom);
 * are all unitary, they are not just bags of other geometries.
 */
 extern int lwgeom_is_unitary(const LWGEOM *geom);
+extern int lwtype_is_unitary(uint32_t lwtype);
 
 /**
 * Is this a type that has rings enclosing an area, but is
diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index b581c9702..2e6d4e8a1 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -1101,9 +1101,9 @@ lwgeom_is_collection(const LWGEOM *geom)
 }
 
 int
-lwgeom_is_unitary(const LWGEOM *geom)
+lwtype_is_unitary(uint32_t lwtype)
 {
-	switch (geom->type)
+	switch (lwtype)
 	{
 	case POINTTYPE:
 	case LINETYPE:
@@ -1120,6 +1120,12 @@ lwgeom_is_unitary(const LWGEOM *geom)
 	}
 }
 
+int
+lwgeom_is_unitary(const LWGEOM *geom)
+{
+	return lwtype_is_unitary(geom->type);
+}
+
 int
 lwgeom_has_rings(const LWGEOM *geom)
 {
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 974fad631..1e126ce82 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2161,8 +2161,8 @@ PG_FUNCTION_INFO_V1(ST_IsCollection);
 Datum ST_IsCollection(PG_FUNCTION_ARGS)
 {
 	GSERIALIZED *geom = PG_GETARG_GSERIALIZED_HEADER(0);
-	LWGEOM *lwg = lwgeom_from_gserialized(geom);
-	PG_RETURN_BOOL(!lwgeom_is_unitary(lwg));
+	uint32_t lwtype = gserialized_get_type(geom);
+	PG_RETURN_BOOL(!lwtype_is_unitary(lwtype));
 }
 
 PG_FUNCTION_INFO_V1(LWGEOM_makepoint);
diff --git a/regress/core/coverage.sql b/regress/core/coverage.sql
index f0d1f5a9b..c78c3c0a3 100644
--- a/regress/core/coverage.sql
+++ b/regress/core/coverage.sql
@@ -52,20 +52,6 @@ SELECT 'three partition b' AS test,
   id, ST_Area(ST_CoverageUnion(geom))
 FROM coverage GROUP BY id ORDER BY id;
 
-
-TRUNCATE coverage;
-INSERT INTO coverage VALUES
-(4, 1, 'POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))'),
-(4, 2, 'POLYGON ((1 0, 0.9 1, 2 1, 2 0, 1 0))');
-
-WITH u AS (
-  SELECT ST_CoverageUnion(geom) AS geom FROM coverage
-)
-SELECT 'union 2' AS test,
-  ST_Area(geom), ST_GeometryType(geom)
-FROM u;
-
-
 TRUNCATE coverage;
 INSERT INTO coverage VALUES
 (5, 1, 'POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))'),
diff --git a/regress/core/coverage_expected b/regress/core/coverage_expected
index 5d19e968a..2b456107a 100644
--- a/regress/core/coverage_expected
+++ b/regress/core/coverage_expected
@@ -15,7 +15,6 @@ three partition a|3|2|||
 three partition b|1|200
 three partition b|2|200
 three partition b|3|
-union 2|2.05|ST_MultiPolygon
 union 3|2|ST_Polygon
 grid lanes|0|110000
 grid lanes|1|110000

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

Summary of changes:
 NEWS                             |  1 +
 liblwgeom/liblwgeom.h.in         |  1 +
 liblwgeom/lwgeom.c               | 10 ++++++++--
 postgis/lwgeom_functions_basic.c |  4 ++--
 regress/core/coverage.sql        | 14 --------------
 regress/core/coverage_expected   |  1 -
 6 files changed, 12 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list