[SCM] PostGIS branch master updated. 3.6.0rc2-663-g98bf6ad50

git at osgeo.org git at osgeo.org
Wed Jun 24 01:21:09 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  98bf6ad503163840afa6422b99dad6f4c5b658ce (commit)
      from  d9cdac922f99e86154f7ab04392280c61c87c912 (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 98bf6ad503163840afa6422b99dad6f4c5b658ce
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 19:29:57 2026 +0400

    topology: avoid MinGW format warnings
    
    Use PostgreSQL integer-to-string helpers when topology backend diagnostics need 64-bit element ids or row counts. This avoids MinGW printf-format warnings without changing appendStringInfo SQL builders.
    
    Closes https://trac.osgeo.org/postgis/ticket/5904
    Closes https://github.com/postgis/postgis/pull/975

diff --git a/NEWS b/NEWS
index 36b96fe56..e3d1d2fa9 100644
--- a/NEWS
+++ b/NEWS
@@ -117,6 +117,8 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
  - #2386, Add missing raster2pgsql man page (Darafei Praliaskouski)
  - #5975, Initialize skipped union-find cluster ids deterministically
           (Darafei Praliaskouski)
+ - #5904, [topology] Avoid MinGW format warnings when logging topology ids
+          (Darafei Praliaskouski)
  - GH-885, [topology] Avoid GMP overflow in ring orientation for very large
           finite coordinates (Darafei Praliaskouski)
  - GH-892, Add OSS-Fuzz coverage for TWKB and serialized raster inputs,
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 0599fc010..2eb19bb67 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -13,7 +13,7 @@
 #include "postgres.h"
 #include "fmgr.h"
 #include "c.h" /* for UINT64_FORMAT and uint64 */
-#include "utils/builtins.h" /* for cstring_to_text */
+#include "utils/builtins.h" /* for cstring_to_text, pg_lltoa, pg_ulltoa_n */
 #include "utils/elog.h"
 #include "utils/memutils.h" /* for transaction contexts */
 #include "utils/array.h" /* for ArrayType */
@@ -98,6 +98,23 @@ struct LWT_BE_TOPOLOGY_T
 
 /* utility funx */
 
+#define LWT_BE_INT64_BUFSIZE 32
+
+static const char *
+lwt_be_int64_to_str(int64 value, char *buf)
+{
+	pg_lltoa(value, buf);
+	return buf;
+}
+
+static const char *
+lwt_be_uint64_to_str(uint64 value, char *buf)
+{
+	int len = pg_ulltoa_n(value, buf);
+	buf[len] = '\0';
+	return buf;
+}
+
 static void cberror(const LWT_BE_DATA* be, const char *fmt, ...)
 __attribute__ (( format(printf, 2, 3) ));
 
@@ -1291,13 +1308,12 @@ cb_getRingEdges(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID edge, uint64_t *numelems
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
-    cberror(
-      topo->be_data,
-      "No edge with id %" LWTFMT_ELEMID" in Topology \"%s\"",
-      ABS(edge),
-      topo->name
-    );
-    return NULL;
+	  char edge_id[LWT_BE_INT64_BUFSIZE];
+	  cberror(topo->be_data,
+		  "No edge with id %s in Topology \"%s\"",
+		  lwt_be_int64_to_str(ABS(edge), edge_id),
+		  topo->name);
+	  return NULL;
   }
   if (limit && *numelems == (uint64_t)limit)
   {
@@ -1337,12 +1353,11 @@ cb_getRingEdges(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID edge, uint64_t *numelems
       dat = SPI_getbinval(row, rowdesc, sidecol, &isnull);
       if ( isnull )
       {
-        lwfree(edges);
-        cberror(topo->be_data, "Edge %" LWTFMT_ELEMID
-                               " has NULL next_%s_edge",
-                               val, sidetext);
-        *numelems = UINT64_MAX;
-        return NULL;
+	      char edge_id[LWT_BE_INT64_BUFSIZE];
+	      lwfree(edges);
+	      cberror(topo->be_data, "Edge %s has NULL next_%s_edge", lwt_be_int64_to_str(val, edge_id), sidetext);
+	      *numelems = UINT64_MAX;
+	      return NULL;
       }
       nextedge = tuple_get_int64(rowdesc, sidecol, dat);
       POSTGIS_DEBUGF(1, "Last component in ring of edge %"
@@ -1350,12 +1365,13 @@ cb_getRingEdges(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID edge, uint64_t *numelems
                         edge, val, sidetext, nextedge);
       if ( nextedge != edge )
       {
-        lwfree(edges);
-        cberror(topo->be_data, "Corrupted topology: ring of edge %"
-                               LWTFMT_ELEMID " is topologically non-closed",
-                               edge);
-        *numelems = UINT64_MAX;
-        return NULL;
+	      char edge_id[LWT_BE_INT64_BUFSIZE];
+	      lwfree(edges);
+	      cberror(topo->be_data,
+		      "Corrupted topology: ring of edge %s is topologically non-closed",
+		      lwt_be_int64_to_str(edge, edge_id));
+	      *numelems = UINT64_MAX;
+	      return NULL;
       }
     }
 
@@ -1606,10 +1622,12 @@ cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY *topo,
     if ( fields ) addNodeFields(sql, fields);
     else
     {
-      lwpgwarning("liblwgeom-topo invoked 'getNodeWithinDistance2D' "
-                  "backend callback with limit=" UINT64_FORMAT " and no fields",
-                  elems_requested);
-      appendStringInfo(sql, "*");
+	    char limit_str[LWT_BE_INT64_BUFSIZE];
+	    lwpgwarning(
+		"liblwgeom-topo invoked 'getNodeWithinDistance2D' "
+		"backend callback with limit=%s and no fields",
+		lwt_be_int64_to_str(elems_requested, limit_str));
+	    appendStringInfo(sql, "*");
     }
   }
   appendStringInfo(sql, " FROM \"%s\".node", topo->name);
@@ -1725,10 +1743,12 @@ cb_insertNodes(const LWT_BE_TOPOLOGY *topo, LWT_ISO_NODE *nodes, uint64_t numele
 
   if (SPI_processed != numelems)
   {
+	  char processed_str[LWT_BE_INT64_BUFSIZE];
+	  char expected_str[LWT_BE_INT64_BUFSIZE];
 	  cberror(topo->be_data,
-		  "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
-		  (uint64)SPI_processed,
-		  (uint64)numelems);
+		  "processed %s rows, expected %s",
+		  lwt_be_uint64_to_str((uint64)SPI_processed, processed_str),
+		  lwt_be_uint64_to_str((uint64)numelems, expected_str));
 	  return 0;
   }
 
@@ -1785,10 +1805,12 @@ cb_insertEdges(const LWT_BE_TOPOLOGY *topo, LWT_ISO_EDGE *edges, uint64_t numele
   POSTGIS_DEBUGF(1, "cb_insertEdges query processed " UINT64_FORMAT " rows", SPI_processed);
   if ( SPI_processed != (uint64) numelems )
   {
+	  char processed_str[LWT_BE_INT64_BUFSIZE];
+	  char expected_str[LWT_BE_INT64_BUFSIZE];
 	  cberror(topo->be_data,
-		  "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
-		  (uint64)SPI_processed,
-		  (uint64)numelems);
+		  "processed %s rows, expected %s",
+		  lwt_be_uint64_to_str((uint64)SPI_processed, processed_str),
+		  lwt_be_uint64_to_str((uint64)numelems, expected_str));
 	  return -1;
   }
 
@@ -1846,10 +1868,12 @@ cb_insertFaces(const LWT_BE_TOPOLOGY *topo, LWT_ISO_FACE *faces, uint64_t numele
   POSTGIS_DEBUGF(1, "cb_insertFaces query processed " UINT64_FORMAT " rows", SPI_processed);
   if (SPI_processed != numelems)
   {
+	  char processed_str[LWT_BE_INT64_BUFSIZE];
+	  char expected_str[LWT_BE_INT64_BUFSIZE];
 	  cberror(topo->be_data,
-		  "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
-		  (uint64)SPI_processed,
-		  (uint64)numelems);
+		  "processed %s rows, expected %s",
+		  lwt_be_uint64_to_str((uint64)SPI_processed, processed_str),
+		  lwt_be_uint64_to_str((uint64)numelems, expected_str));
 	  return -1;
   }
 
@@ -2242,7 +2266,10 @@ cb_getNextEdgeId( const LWT_BE_TOPOLOGY* topo )
 
   if ( SPI_processed != 1 )
   {
-	  cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected 1", (uint64)SPI_processed);
+	  char processed_str[LWT_BE_INT64_BUFSIZE];
+	  cberror(topo->be_data,
+		  "processed %s rows, expected 1",
+		  lwt_be_uint64_to_str((uint64)SPI_processed, processed_str));
 	  return -1;
   }
 
@@ -2575,11 +2602,20 @@ cb_checkTopoGeomRemEdge ( const LWT_BE_TOPOLOGY* topo,
 
     SPI_freetuptable(SPI_tuptable);
 
-    cberror(topo->be_data, "TopoGeom %s in layer %s "
-            "(%s.%s.%s) cannot be represented "
-            "dropping edge %" LWTFMT_ELEMID,
-            tg_id, layer_id, schema_name, table_name,
-            col_name, rem_edge);
+    {
+	    char edge_id[LWT_BE_INT64_BUFSIZE];
+
+	    cberror(topo->be_data,
+		    "TopoGeom %s in layer %s "
+		    "(%s.%s.%s) cannot be represented "
+		    "dropping edge %s",
+		    tg_id,
+		    layer_id,
+		    schema_name,
+		    table_name,
+		    col_name,
+		    lwt_be_int64_to_str(rem_edge, edge_id));
+    }
     return 0;
   }
 
@@ -2634,12 +2670,22 @@ cb_checkTopoGeomRemEdge ( const LWT_BE_TOPOLOGY* topo,
 
       SPI_freetuptable(SPI_tuptable);
 
-      cberror(topo->be_data, "TopoGeom %s in layer %s "
-              "(%s.%s.%s) cannot be represented "
-              "healing faces %" LWTFMT_ELEMID
-              " and %" LWTFMT_ELEMID,
-              tg_id, layer_id, schema_name, table_name,
-              col_name, face_right, face_left);
+      {
+	      char face_left_id[LWT_BE_INT64_BUFSIZE];
+	      char face_right_id[LWT_BE_INT64_BUFSIZE];
+
+	      cberror(topo->be_data,
+		      "TopoGeom %s in layer %s "
+		      "(%s.%s.%s) cannot be represented "
+		      "healing faces %s and %s",
+		      tg_id,
+		      layer_id,
+		      schema_name,
+		      table_name,
+		      col_name,
+		      lwt_be_int64_to_str(face_right, face_right_id),
+		      lwt_be_int64_to_str(face_left, face_left_id));
+      }
       return 0;
     }
   }
@@ -2697,11 +2743,20 @@ cb_checkTopoGeomRemIsoEdge ( const LWT_BE_TOPOLOGY* topo,
 
     SPI_freetuptable(SPI_tuptable);
 
-    cberror(topo->be_data, "TopoGeom %s in layer %s "
-            "(%s.%s.%s) cannot be represented "
-            "dropping edge %" LWTFMT_ELEMID,
-            tg_id, layer_id, schema_name, table_name,
-            col_name, rem_edge);
+    {
+	    char edge_id[LWT_BE_INT64_BUFSIZE];
+
+	    cberror(topo->be_data,
+		    "TopoGeom %s in layer %s "
+		    "(%s.%s.%s) cannot be represented "
+		    "dropping edge %s",
+		    tg_id,
+		    layer_id,
+		    schema_name,
+		    table_name,
+		    col_name,
+		    lwt_be_int64_to_str(rem_edge, edge_id));
+    }
     return 0;
   }
 
@@ -2769,12 +2824,22 @@ cb_checkTopoGeomRemNode ( const LWT_BE_TOPOLOGY* topo,
 
     SPI_freetuptable(SPI_tuptable);
 
-    cberror(topo->be_data, "TopoGeom %s in layer %s "
-            "(%s.%s.%s) cannot be represented "
-            "healing edges %" LWTFMT_ELEMID
-            " and %" LWTFMT_ELEMID,
-            tg_id, layer_id, schema_name, table_name,
-            col_name, edge1, edge2);
+    {
+	    char edge1_id[LWT_BE_INT64_BUFSIZE];
+	    char edge2_id[LWT_BE_INT64_BUFSIZE];
+
+	    cberror(topo->be_data,
+		    "TopoGeom %s in layer %s "
+		    "(%s.%s.%s) cannot be represented "
+		    "healing edges %s and %s",
+		    tg_id,
+		    layer_id,
+		    schema_name,
+		    table_name,
+		    col_name,
+		    lwt_be_int64_to_str(edge1, edge1_id),
+		    lwt_be_int64_to_str(edge2, edge2_id));
+    }
     return 0;
   }
 
@@ -2818,13 +2883,24 @@ cb_checkTopoGeomRemNode ( const LWT_BE_TOPOLOGY* topo,
 
     SPI_freetuptable(SPI_tuptable);
 
-    cberror(topo->be_data, "TopoGeom %s in layer %s "
-            "(%s.%s.%s) cannot be represented "
-            "removing node %" LWTFMT_ELEMID
-            " connecting edges %" LWTFMT_ELEMID
-            " and %" LWTFMT_ELEMID,
-            tg_id, layer_id, schema_name, table_name,
-            col_name, rem_node, edge1, edge2);
+    {
+	    char node_id[LWT_BE_INT64_BUFSIZE];
+	    char edge1_id[LWT_BE_INT64_BUFSIZE];
+	    char edge2_id[LWT_BE_INT64_BUFSIZE];
+
+	    cberror(topo->be_data,
+		    "TopoGeom %s in layer %s "
+		    "(%s.%s.%s) cannot be represented "
+		    "removing node %s connecting edges %s and %s",
+		    tg_id,
+		    layer_id,
+		    schema_name,
+		    table_name,
+		    col_name,
+		    lwt_be_int64_to_str(rem_node, node_id),
+		    lwt_be_int64_to_str(edge1, edge1_id),
+		    lwt_be_int64_to_str(edge2, edge2_id));
+    }
     return 0;
   }
 
@@ -2885,11 +2961,20 @@ cb_checkTopoGeomRemIsoNode ( const LWT_BE_TOPOLOGY* topo, LWT_ELEMID rem_node )
 
     SPI_freetuptable(SPI_tuptable);
 
-    cberror(topo->be_data, "TopoGeom %s in layer %s "
-            "(%s.%s.%s) cannot be represented "
-            "removing node %" LWTFMT_ELEMID,
-            tg_id, layer_id, schema_name, table_name,
-            col_name, rem_node);
+    {
+	    char node_id[LWT_BE_INT64_BUFSIZE];
+
+	    cberror(topo->be_data,
+		    "TopoGeom %s in layer %s "
+		    "(%s.%s.%s) cannot be represented "
+		    "removing node %s",
+		    tg_id,
+		    layer_id,
+		    schema_name,
+		    table_name,
+		    col_name,
+		    lwt_be_int64_to_str(rem_node, node_id));
+    }
     return 0;
   }
 
@@ -3202,13 +3287,12 @@ cb_computeFaceMBR(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID face)
 
   if ( ! SPI_processed )
   {
-    cberror(
-      topo->be_data,
-      "Face with id %" LWTFMT_ELEMID" in topology \"%s\" has no edges",
-      face,
-      topo->name
-    );
-    return NULL;
+	  char face_id[LWT_BE_INT64_BUFSIZE];
+	  cberror(topo->be_data,
+		  "Face with id %s in topology \"%s\" has no edges",
+		  lwt_be_int64_to_str(face, face_id),
+		  topo->name);
+	  return NULL;
   }
 
   row = SPI_tuptable->vals[0];
@@ -3216,13 +3300,12 @@ cb_computeFaceMBR(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID face)
 
   if ( isnull )
   {
-    cberror(
-      topo->be_data,
-      "Face with id %" LWTFMT_ELEMID" in topology \"%s\" has null edges ?",
-      face,
-      topo->name
-    );
-    return NULL;
+	  char face_id[LWT_BE_INT64_BUFSIZE];
+	  cberror(topo->be_data,
+		  "Face with id %s in topology \"%s\" has null edges ?",
+		  lwt_be_int64_to_str(face, face_id),
+		  topo->name);
+	  return NULL;
   }
 
   geom = (GSERIALIZED *)PG_DETOAST_DATUM(dat);
@@ -3237,13 +3320,12 @@ cb_computeFaceMBR(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID face)
   }
   else
   {
-    cberror(
-      topo->be_data,
-      "Face with id %" LWTFMT_ELEMID" in topology \"%s\" has empty MBR ?",
-      face,
-      topo->name
-    );
-    return NULL;
+	  char face_id[LWT_BE_INT64_BUFSIZE];
+	  cberror(topo->be_data,
+		  "Face with id %s in topology \"%s\" has empty MBR ?",
+		  lwt_be_int64_to_str(face, face_id),
+		  topo->name);
+	  return NULL;
   }
   lwgeom_free(lwg);
   if ( DatumGetPointer(dat) != (Pointer)geom ) pfree(geom);

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

Summary of changes:
 NEWS                        |   2 +
 topology/postgis_topology.c | 260 +++++++++++++++++++++++++++++---------------
 2 files changed, 173 insertions(+), 89 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list