[SCM] PostGIS branch master updated. 3.6.0rc2-600-g184d3a567

git at osgeo.org git at osgeo.org
Thu Jun 18 06:32:40 PDT 2026


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, master has been updated
       via  184d3a567885288608c1049c4cbe32f7058176dc (commit)
       via  c3004485c01808aaedefbf75d6b8de9090739811 (commit)
       via  b90c3dbb175c92ea3c113c38cacc6a3617a51695 (commit)
       via  ea9c759b0b8d6c9b27fa5e12c5bb0be8b3405c66 (commit)
       via  9b9950de1262a24c41e9e4d647627b1816a6ac52 (commit)
       via  014d02c42befac740f904b1cceca52391b671097 (commit)
       via  cff529aa81f12c0dc12b2b273a0e836e38c3f122 (commit)
       via  8c034d0faef7819f920cb4d921068217f679c1cd (commit)
       via  9cc6dac3d6d9c119667a438118cb4b5b6bb21c3b (commit)
       via  d078fd9e158e18640e901eed329dca1f0cbc0133 (commit)
       via  67d6df38c343a8be4605061e330587d9aafaffaf (commit)
      from  07e64e5f0f1361abec66940c45b951d835c5bd1f (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 184d3a567885288608c1049c4cbe32f7058176dc
Merge: 07e64e5f0 c3004485c
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 17:30:25 2026 +0400

    Merge Weblate manual repository state
    
    Record Weblate's exported master as merged after the PR landing history rewrite, so Weblate can fast-forward to the resolved upstream state instead of replaying duplicate PR commits and conflicting in NEWS.


commit c3004485c01808aaedefbf75d6b8de9090739811
Merge: b90c3dbb1 d078fd9e1
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 16:55:30 2026 +0400

    Merge PR #903: Avoid size_t log formats for MinGW
    
    Replace size_t formatting in liblwgeom logging and error messages with unsigned-long casts so MinGW builds do not warn on unsupported %zu format specifiers.

diff --cc NEWS
index 5ca8c2631,1aa7f0626..6f57e1a8c
--- a/NEWS
+++ b/NEWS
@@@ -55,11 -54,8 +55,13 @@@ To take advantage of all postgis_sfcga
            finite coordinates (Darafei Praliaskouski)
   - GH-892, Add OSS-Fuzz coverage for TWKB and serialized raster inputs,
            including guards for malformed TWKB reads and counts (Darafei Praliaskouski)
 + - GH-888, [sfcgal] Avoid stale detoasted geometry access in
 +          CG_Visibility empty-input handling for SFCGAL < 2.2
 +          (Darafei Praliaskouski)
 + - #3179, Mark truncated libpgcommon PostgreSQL messages instead of silently
 +          dropping the tail (Darafei Praliaskouski)
+  - #6003, Avoid size_t formats in liblwgeom logging/error wrappers for
+           MinGW builds (Darafei Praliaskouski)
   - Build PostgreSQL extension modules with `-fno-semantic-interposition` when
            available so LTO can optimize same-DSO calls to exported PostGIS
            entry points directly instead of routing through the module PLT; in

commit b90c3dbb175c92ea3c113c38cacc6a3617a51695
Merge: ea9c759b0 67d6df38c
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 16:46:19 2026 +0400

    Merge PR #932: Mark truncated PostgreSQL messages
    
    Make libpgcommon append a truncation marker when fixed-size PostgreSQL message formatting overflows, so error, warning, notice, and debug messages no longer lose their tail silently.

diff --cc NEWS
index a314e2be7,2910943b4..5ca8c2631
--- a/NEWS
+++ b/NEWS
@@@ -55,9 -54,8 +55,11 @@@ To take advantage of all postgis_sfcga
            finite coordinates (Darafei Praliaskouski)
   - GH-892, Add OSS-Fuzz coverage for TWKB and serialized raster inputs,
            including guards for malformed TWKB reads and counts (Darafei Praliaskouski)
 + - GH-888, [sfcgal] Avoid stale detoasted geometry access in
 +          CG_Visibility empty-input handling for SFCGAL < 2.2
 +          (Darafei Praliaskouski)
+  - #3179, Mark truncated libpgcommon PostgreSQL messages instead of silently
+           dropping the tail (Darafei Praliaskouski)
   - Build PostgreSQL extension modules with `-fno-semantic-interposition` when
            available so LTO can optimize same-DSO calls to exported PostGIS
            entry points directly instead of routing through the module PLT; in

commit ea9c759b0b8d6c9b27fa5e12c5bb0be8b3405c66
Merge: 9b9950de1 8c034d0fa
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 16:37:46 2026 +0400

    Merge PR #900: Fix SFCGAL regression gating and roof checks
    
    Gate polygon-repair regression tests on the CGAL version that provides the exercised behavior, keep SFCGAL 2.3-only regression selection together, and add generic roof-generation checks against the specialized wrappers.


commit 9b9950de1262a24c41e9e4d647627b1816a6ac52
Merge: 014d02c42 9cc6dac3d
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 16:27:57 2026 +0400

    Merge PR #888: Fix SFCGAL visibility empty input handling
    
    Avoid stale detoasted geometry access in CG_Visibility empty-input compatibility handling for builds against SFCGAL before 2.2, while preserving the empty polygon result for empty inputs.


commit 014d02c42befac740f904b1cceca52391b671097
Merge: 857652e24 cff529aa8
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 16:18:43 2026 +0400

    Merge PR #959: Stabilize NURBS approximation regression output
    
    Apply explicit two-decimal ST_AsText output for the high-tolerance NURBS approximation regression so SFCGAL/CGAL precision drift does not fail otherwise unrelated CI runs.
    
    Validation: GitHub CI green on cff529aa81f12c0dc12b2b273a0e836e38c3f122; local git diff --check upstream/master..HEAD passed; local make -C sfcgal/regress check RUNTESTFLAGS='--verbose --extension' TESTS="/home/kom/proj/osgeo/postgis/sfcgal/regress/nurbs.sql" passed, including automatic upgrade rerun.


commit cff529aa81f12c0dc12b2b273a0e836e38c3f122
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 11:23:12 2026 +0400

    Stabilize NURBS approximation regression output

diff --git a/sfcgal/regress/nurbs.sql b/sfcgal/regress/nurbs.sql
index a71fc9f54..bed1a0361 100644
--- a/sfcgal/regress/nurbs.sql
+++ b/sfcgal/regress/nurbs.sql
@@ -96,7 +96,7 @@ SELECT 'approximate_high_tol', ST_AsText(CG_NurbsCurveApproximate(
     'LINESTRING(0 0, 1 2.1, 2 1.9, 3 3.2, 4 2.8, 5 1)'::geometry,
     2,
     0.5
-));
+), 2);
 
 -- Test approximation with 3D points
 SELECT 'approximate_3d', ST_AsText(CG_NurbsCurveApproximate(
diff --git a/sfcgal/regress/nurbs_expected b/sfcgal/regress/nurbs_expected
index a7e2856fb..9ccee264f 100644
--- a/sfcgal/regress/nurbs_expected
+++ b/sfcgal/regress/nurbs_expected
@@ -10,6 +10,6 @@ ERROR:  Data points must be a LINESTRING
 ERROR:  Need at least 4 data points for degree 3 interpolation
 approximate_default|NURBSCURVE(DEGREE 3,CONTROLPOINTS(NURBSPOINT(WEIGHTEDPOINT(0 0),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(0.18 -0.15),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(1.49 4.36),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(3.33 1.33),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(4.34 0.83),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(5 0),WEIGHT 1)),KNOTS (KNOT(0,4),KNOT(0.46,1),KNOT(0.64,1),KNOT(1,4)))
 approximate_max_ctrl|NURBSCURVE(DEGREE 3,CONTROLPOINTS(NURBSPOINT(WEIGHTEDPOINT(0 0),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(3.3 6.18),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(6.48 40.13),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(8.84 73.32),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(10 100),WEIGHT 1)),KNOTS (KNOT(0,4),KNOT(0.21,1),KNOT(1,4)))
-approximate_high_tol|NURBSCURVE(DEGREE 2,CONTROLPOINTS(NURBSPOINT(WEIGHTEDPOINT(0 0),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(-0.048424154393691 2.640915492953116),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(2.237552942255657 1.646186724700419),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(2.786598026195684 3.476253776863865),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(4.840573182610214 2.429625830321494),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(5 1),WEIGHT 1)),KNOTS (KNOT(0,3),KNOT(0.349154606588781,1),KNOT(0.512902297757245,1),KNOT(0.680173066921787,1),KNOT(1,3)))
+approximate_high_tol|NURBSCURVE(DEGREE 2,CONTROLPOINTS(NURBSPOINT(WEIGHTEDPOINT(0 0),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(-0.05 2.64),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(2.24 1.65),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(2.79 3.48),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(4.84 2.43),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT(5 1),WEIGHT 1)),KNOTS (KNOT(0,3),KNOT(0.35,1),KNOT(0.51,1),KNOT(0.68,1),KNOT(1,3)))
 approximate_3d|NURBSCURVE Z (DEGREE 3,CONTROLPOINTS Z (NURBSPOINT(WEIGHTEDPOINT Z (0 0 0),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT Z (0.18 -0.15 -1.29),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT Z (1.49 4.36 3.35),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT Z (3.33 1.33 0.38),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT Z (4.34 0.83 -0.44),WEIGHT 1),NURBSPOINT(WEIGHTEDPOINT Z (5 0 0),WEIGHT 1)),KNOTS (KNOT(0,4),KNOT(0.46,1),KNOT(0.64,1),KNOT(1,4)))
 ERROR:  Need at least 4 data points for degree 3 approximation

commit 8c034d0faef7819f920cb4d921068217f679c1cd
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Tue Jun 16 23:37:32 2026 +0400

    sfcgal: fix regression gating and roof checks

diff --git a/sfcgal/regress/roofgeneration.sql b/sfcgal/regress/roofgeneration.sql
index 106f5105e..50b11ab16 100644
--- a/sfcgal/regress/roofgeneration.sql
+++ b/sfcgal/regress/roofgeneration.sql
@@ -13,4 +13,10 @@ SELECT 'generic_hipped', ST_AsText(CG_GenerateRoof('POLYGON((0 0,4 0,4 4,0 4,0 0
 SELECT 'generic_flat', ST_AsText(CG_GenerateRoof('POLYGON((0 0,4 0,4 4,0 4,0 0))', 'FLAT', 2.0, 30.0, 0));
 SELECT 'generic_gable_3d', ST_CoordDim(CG_GenerateRoof('POLYGON((0 0,4 0,4 4,0 4,0 0))', 'GABLE', 2.0, 30.0, 0));
 SELECT 'generic_skillion_3d', ST_CoordDim(CG_GenerateRoof('POLYGON((0 0,4 0,4 4,0 4,0 0))', 'SKILLION', 2.0, 30.0, 0));
+SELECT 'generic_gable_matches_specialized',
+  ST_AsText(CG_GenerateRoof('POLYGON((0 0,4 0,4 4,0 4,0 0))', 'GABLE', 5.0, 15.0, 0)) =
+  ST_AsText(CG_GenerateGableRoof('POLYGON((0 0,4 0,4 4,0 4,0 0))', 5.0, 15.0));
+SELECT 'generic_skillion_matches_specialized',
+  ST_AsText(CG_GenerateRoof('POLYGON((0 0,4 0,4 4,0 4,0 0))', 'SKILLION', 5.0, 15.0, 0)) =
+  ST_AsText(CG_GenerateSkillionRoof('POLYGON((0 0,4 0,4 4,0 4,0 0))', 5.0, 15.0, 0));
 SELECT 'invalid_type', CG_GenerateRoof('POLYGON((0 0,4 0,4 4,0 4,0 0))', 'DOME', 2.0, 30.0, 0);
diff --git a/sfcgal/regress/roofgeneration_expected b/sfcgal/regress/roofgeneration_expected
index d67b1e24d..d90fef96f 100644
--- a/sfcgal/regress/roofgeneration_expected
+++ b/sfcgal/regress/roofgeneration_expected
@@ -8,4 +8,6 @@ generic_hipped|POLYHEDRALSURFACE Z (((0 4 0,4 4 0,4 0 0,0 0 0,0 4 0)),((0 4 0,0
 generic_flat|POLYHEDRALSURFACE Z (((0 0 0,0 4 0,4 4 0,4 0 0,0 0 0)),((0 0 2,4 0 2,4 4 2,0 4 2,0 0 2)),((0 0 0,0 0 2,0 4 2,0 4 0,0 0 0)),((0 4 0,0 4 2,4 4 2,4 4 0,0 4 0)),((4 4 0,4 4 2,4 0 2,4 0 0,4 4 0)),((4 0 0,4 0 2,0 0 2,0 0 0,4 0 0)))
 generic_gable_3d|3
 generic_skillion_3d|3
+generic_gable_matches_specialized|t
+generic_skillion_matches_specialized|t
 ERROR:  CG_GenerateRoof: unknown roof type 'DOME', expected FLAT, HIPPED, GABLE or SKILLION
diff --git a/sfcgal/regress/tests.mk.in b/sfcgal/regress/tests.mk.in
index 89b2e4627..c1c39d069 100644
--- a/sfcgal/regress/tests.mk.in
+++ b/sfcgal/regress/tests.mk.in
@@ -49,13 +49,15 @@ ifeq ($(shell expr "$(POSTGIS_SFCGAL_VERSION)" ">=" 20300),1)
 	TESTS += \
 		$(top_srcdir)/sfcgal/regress/alphashape_components.sql \
 		$(top_srcdir)/sfcgal/regress/roofgeneration.sql \
-		$(top_srcdir)/sfcgal/regress/polygonrepair.sql \
 		$(top_srcdir)/sfcgal/regress/approximatemedialaxis_projected.sql \
 		$(top_srcdir)/sfcgal/regress/nurbs.sql
-	ifeq ($(shell expr "$(POSTGIS_CGAL_VERSION)" ">=" 601),1)
-		TESTS += $(top_srcdir)/sfcgal/regress/polygonrepair_union.sql
-	else
-		TESTS += $(top_srcdir)/sfcgal/regress/polygonrepair_union_pre61.sql
+	ifeq ($(shell expr "$(POSTGIS_CGAL_VERSION)" ">=" 600),1)
+		TESTS += $(top_srcdir)/sfcgal/regress/polygonrepair.sql
+		ifeq ($(shell expr "$(POSTGIS_CGAL_VERSION)" ">=" 601),1)
+			TESTS += $(top_srcdir)/sfcgal/regress/polygonrepair_union.sql
+		else
+			TESTS += $(top_srcdir)/sfcgal/regress/polygonrepair_union_pre61.sql
+		endif
 	endif
 else
 	TESTS += \

commit 9cc6dac3d6d9c119667a438118cb4b5b6bb21c3b
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Tue Jun 16 17:15:54 2026 +0400

    Fix SFCGAL visibility empty input handling

diff --git a/NEWS b/NEWS
index 4cd72746a..cf06261d4 100644
--- a/NEWS
+++ b/NEWS
@@ -54,6 +54,9 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
           finite coordinates (Darafei Praliaskouski)
  - GH-892, Add OSS-Fuzz coverage for TWKB and serialized raster inputs,
           including guards for malformed TWKB reads and counts (Darafei Praliaskouski)
+ - GH-888, [sfcgal] Avoid stale detoasted geometry access in
+          CG_Visibility empty-input handling for SFCGAL < 2.2
+          (Darafei Praliaskouski)
  - Build PostgreSQL extension modules with `-fno-semantic-interposition` when
           available so LTO can optimize same-DSO calls to exported PostGIS
           entry points directly instead of routing through the module PLT; in
diff --git a/sfcgal/lwgeom_sfcgal.c b/sfcgal/lwgeom_sfcgal.c
index 5ee90f878..0289ccb21 100644
--- a/sfcgal/lwgeom_sfcgal.c
+++ b/sfcgal/lwgeom_sfcgal.c
@@ -19,6 +19,7 @@
  **********************************************************************
  *
  * Copyright 2012-2020 Oslandia <infos at oslandia.com>
+ * Copyright 2026 Darafei Praliaskouski <me at komzpa.net>
  *
  **********************************************************************/
 
@@ -1232,22 +1233,30 @@ sfcgal_visibility_point(PG_FUNCTION_ARGS)
 	input0 = PG_GETARG_GSERIALIZED_P(0);
 	srid = gserialized_get_srid(input0);
 	input1 = PG_GETARG_GSERIALIZED_P(1);
-	polygon = POSTGIS2SFCGALGeometry(input0);
-	PG_FREE_IF_COPY(input0, 0);
-	point = POSTGIS2SFCGALGeometry(input1);
-	PG_FREE_IF_COPY(input1, 1);
 
 #if POSTGIS_SFCGAL_VERSION < 20200
+	/*
+	 * SFCGAL < 2.2 needs PostGIS to preserve the empty-input result.
+	 * Check this before converting and freeing detoasted inputs, because
+	 * gserialized_is_empty() must not inspect a freed copy.
+	 */
 	if (gserialized_is_empty(input0) || gserialized_is_empty(input1))
 	{
 		result = sfcgal_polygon_create();
 		output = SFCGALGeometry2POSTGIS(result, 0, srid);
 		sfcgal_geometry_delete(result);
 
+		PG_FREE_IF_COPY(input0, 0);
+		PG_FREE_IF_COPY(input1, 1);
 		PG_RETURN_POINTER(output);
 	}
 #endif
 
+	polygon = POSTGIS2SFCGALGeometry(input0);
+	PG_FREE_IF_COPY(input0, 0);
+	point = POSTGIS2SFCGALGeometry(input1);
+	PG_FREE_IF_COPY(input1, 1);
+
 	result = sfcgal_geometry_visibility_point(polygon, point);
 	sfcgal_geometry_delete(polygon);
 	sfcgal_geometry_delete(point);
@@ -1282,24 +1291,33 @@ sfcgal_visibility_segment(PG_FUNCTION_ARGS)
 	srid = gserialized_get_srid(input0);
 	input1 = PG_GETARG_GSERIALIZED_P(1);
 	input2 = PG_GETARG_GSERIALIZED_P(2);
-	polygon = POSTGIS2SFCGALGeometry(input0);
-	PG_FREE_IF_COPY(input0, 0);
-	pointA = POSTGIS2SFCGALGeometry(input1);
-	PG_FREE_IF_COPY(input1, 1);
-	pointB = POSTGIS2SFCGALGeometry(input2);
-	PG_FREE_IF_COPY(input2, 2);
 
 #if POSTGIS_SFCGAL_VERSION < 20200
+	/*
+	 * SFCGAL < 2.2 needs PostGIS to preserve the empty-input result.
+	 * Check this before converting and freeing detoasted inputs, because
+	 * gserialized_is_empty() must not inspect a freed copy.
+	 */
 	if (gserialized_is_empty(input0) || gserialized_is_empty(input1) || gserialized_is_empty(input2))
 	{
 		result = sfcgal_polygon_create();
 		output = SFCGALGeometry2POSTGIS(result, 0, srid);
 		sfcgal_geometry_delete(result);
 
+		PG_FREE_IF_COPY(input0, 0);
+		PG_FREE_IF_COPY(input1, 1);
+		PG_FREE_IF_COPY(input2, 2);
 		PG_RETURN_POINTER(output);
 	}
 #endif
 
+	polygon = POSTGIS2SFCGALGeometry(input0);
+	PG_FREE_IF_COPY(input0, 0);
+	pointA = POSTGIS2SFCGALGeometry(input1);
+	PG_FREE_IF_COPY(input1, 1);
+	pointB = POSTGIS2SFCGALGeometry(input2);
+	PG_FREE_IF_COPY(input2, 2);
+
 	result = sfcgal_geometry_visibility_segment(polygon, pointA, pointB);
 	sfcgal_geometry_delete(polygon);
 	sfcgal_geometry_delete(pointA);

commit d078fd9e158e18640e901eed329dca1f0cbc0133
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Wed Jun 17 01:19:03 2026 +0400

    Avoid size_t formats in lwgeom logs

diff --git a/NEWS b/NEWS
index 4cd72746a..1aa7f0626 100644
--- a/NEWS
+++ b/NEWS
@@ -54,6 +54,8 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
           finite coordinates (Darafei Praliaskouski)
  - GH-892, Add OSS-Fuzz coverage for TWKB and serialized raster inputs,
           including guards for malformed TWKB reads and counts (Darafei Praliaskouski)
+ - #6003, Avoid size_t formats in liblwgeom logging/error wrappers for
+          MinGW builds (Darafei Praliaskouski)
  - Build PostgreSQL extension modules with `-fno-semantic-interposition` when
           available so LTO can optimize same-DSO calls to exported PostGIS
           entry points directly instead of routing through the module PLT; in
diff --git a/liblwgeom/lwgeom_api.c b/liblwgeom/lwgeom_api.c
index 99e51b0ca..bda927801 100644
--- a/liblwgeom/lwgeom_api.c
+++ b/liblwgeom/lwgeom_api.c
@@ -19,12 +19,10 @@
  **********************************************************************
  *
  * Copyright 2001-2006 Refractions Research Inc.
- * Copyright 2017 Darafei Praliaskouski <me at komzpa.net>
+ * Copyright 2017-2026 Darafei Praliaskouski <me at komzpa.net>
  *
  **********************************************************************/
 
-
-
 #include "liblwgeom_internal.h"
 #include "lwgeom_log.h"
 
@@ -452,8 +450,8 @@ void printPA(POINTARRAY *pa)
 	else mflag = "";
 
 	lwnotice("      POINTARRAY%s{", mflag);
-	lwnotice("                 ndims=%i,   ptsize=%zu",
-	         FLAGS_NDIMS(pa->flags), ptarray_point_size(pa));
+	lwnotice(
+	    "                 ndims=%i,   ptsize=%lu", FLAGS_NDIMS(pa->flags), (unsigned long)ptarray_point_size(pa));
 	lwnotice("                 npoints = %u", pa->npoints);
 
 	for (t = 0; t < pa->npoints; t++)
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index 7631081bc..3baae4da6 100644
--- a/liblwgeom/ptarray.c
+++ b/liblwgeom/ptarray.c
@@ -20,10 +20,10 @@
  *
  * Copyright (C) 2012-2021 Sandro Santilli <strk at kbt.io>
  * Copyright (C) 2001-2006 Refractions Research Inc.
+ * Copyright 2026 Darafei Praliaskouski
  *
  **********************************************************************/
 
-
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -533,13 +533,11 @@ ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
 	POINT4D pbuf;
 	size_t ptsize = ptarray_point_size(pa);
 
-	LWDEBUGF(3, "pa %p p %p size %zu where %u",
-	         pa, p, pdims, where);
+	LWDEBUGF(3, "pa %p p %p size %lu where %u", pa, p, (unsigned long)pdims, where);
 
 	if ( pdims < 2 || pdims > 4 )
 	{
-		lwerror("ptarray_addPoint: point dimension out of range (%zu)",
-		        pdims);
+		lwerror("ptarray_addPoint: point dimension out of range (%lu)", (unsigned long)pdims);
 		return NULL;
 	}
 

commit 67d6df38c343a8be4605061e330587d9aafaffaf
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Wed Jun 17 09:57:39 2026 +0400

    libpgcommon: mark truncated PostgreSQL messages

diff --git a/NEWS b/NEWS
index 4cd72746a..2910943b4 100644
--- a/NEWS
+++ b/NEWS
@@ -54,6 +54,8 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
           finite coordinates (Darafei Praliaskouski)
  - GH-892, Add OSS-Fuzz coverage for TWKB and serialized raster inputs,
           including guards for malformed TWKB reads and counts (Darafei Praliaskouski)
+ - #3179, Mark truncated libpgcommon PostgreSQL messages instead of silently
+          dropping the tail (Darafei Praliaskouski)
  - Build PostgreSQL extension modules with `-fno-semantic-interposition` when
           available so LTO can optimize same-DSO calls to exported PostGIS
           entry points directly instead of routing through the module PLT; in
diff --git a/libpgcommon/lwgeom_pg.c b/libpgcommon/lwgeom_pg.c
index fbbe5b73b..d2e2fd061 100644
--- a/libpgcommon/lwgeom_pg.c
+++ b/libpgcommon/lwgeom_pg.c
@@ -43,8 +43,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <string.h>
 
 #define PGC_ERRMSG_MAXLEN 2048 //256
+#define PGC_ERRMSG_TRUNCATED " [truncated]"
 
 /****************************************************************************************/
 /* Global to hold all the run-time constants */
@@ -350,6 +352,28 @@ pg_free(void *ptr)
 	pfree(ptr);
 }
 
+static void
+pg_format_message(char *errmsg, size_t errmsg_size, const char *fmt, va_list ap)
+{
+	int written = vsnprintf(errmsg, errmsg_size, fmt, ap);
+
+	if (written < 0)
+	{
+		strlcpy(errmsg, "[error formatting PostGIS message]", errmsg_size);
+		return;
+	}
+
+	if ((size_t)written >= errmsg_size)
+	{
+		const size_t suffix_size = strlen(PGC_ERRMSG_TRUNCATED);
+
+		if (errmsg_size > suffix_size)
+			memcpy(errmsg + errmsg_size - suffix_size - 1,
+			       PGC_ERRMSG_TRUNCATED,
+			       suffix_size + 1);
+	}
+}
+
 static void pg_error(const char *fmt, va_list ap) __attribute__ (( format(printf, 1, 0) ));
 
 static void
@@ -357,9 +381,7 @@ pg_error(const char *fmt, va_list ap)
 {
 	char errmsg[PGC_ERRMSG_MAXLEN+1];
 
-	vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap);
-
-	errmsg[PGC_ERRMSG_MAXLEN]='\0';
+	pg_format_message(errmsg, sizeof(errmsg), fmt, ap);
 	ereport(ERROR, (errmsg_internal("%s", errmsg)));
 }
 
@@ -370,9 +392,7 @@ pg_warning(const char *fmt, va_list ap)
 {
 	char errmsg[PGC_ERRMSG_MAXLEN+1];
 
-	vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap);
-
-	errmsg[PGC_ERRMSG_MAXLEN]='\0';
+	pg_format_message(errmsg, sizeof(errmsg), fmt, ap);
 	ereport(WARNING, (errmsg_internal("%s", errmsg)));
 }
 
@@ -383,9 +403,7 @@ pg_notice(const char *fmt, va_list ap)
 {
 	char errmsg[PGC_ERRMSG_MAXLEN+1];
 
-	vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap);
-
-	errmsg[PGC_ERRMSG_MAXLEN]='\0';
+	pg_format_message(errmsg, sizeof(errmsg), fmt, ap);
 	ereport(NOTICE, (errmsg_internal("%s", errmsg)));
 }
 
@@ -395,8 +413,7 @@ static void
 pg_debug(int level, const char *fmt, va_list ap)
 {
 	char errmsg[PGC_ERRMSG_MAXLEN+1];
-	vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap);
-	errmsg[PGC_ERRMSG_MAXLEN]='\0';
+	pg_format_message(errmsg, sizeof(errmsg), fmt, ap);
 	int pglevel[6] = {NOTICE, DEBUG1, DEBUG2, DEBUG3, DEBUG4, DEBUG5};
 
 	if ( level >= 0 && level <= 5 )

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

Summary of changes:


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list