[SCM] PostGIS branch stable-3.4 updated. 3.4.4-44-gfc583448b

git at osgeo.org git at osgeo.org
Fri Jul 25 12:14:06 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.4 has been updated
       via  fc583448b8b82367721dda5cba364300880d5d8a (commit)
      from  6e45a5a64547a5c6cae9195c2107a24429005fa2 (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 fc583448b8b82367721dda5cba364300880d5d8a
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Jul 25 12:13:53 2025 -0700

    Support build under Pg19 for easier debugging

diff --git a/NEWS b/NEWS
index 1af726707..0d2c060d1 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ Proj 6.1+ required.
   - #5905, Crash on deeply nested geometries (Paul Ramsey)
   - #5909, ST_ValueCount crashes on empty table (Paul Ramsey)
   - #5917, ST_Relate becomes unresponsive (Paul Ramsey)
+  - Support build under Pg19 (Paul Ramsey)
 
 
 PostGIS 3.4.4
diff --git a/liblwgeom/lwgeom_sfcgal.c b/liblwgeom/lwgeom_sfcgal.c
index 0eb581f43..27c944887 100644
--- a/liblwgeom/lwgeom_sfcgal.c
+++ b/liblwgeom/lwgeom_sfcgal.c
@@ -25,6 +25,16 @@
 #include "lwgeom_sfcgal.h"
 #include <stdio.h>
 
+#if POSTGIS_SFCGAL_VERSION >= 20100
+#define sfcgal_triangulated_surface_num_triangles(g) sfcgal_triangulated_surface_num_patches((g))
+#define sfcgal_triangulated_surface_triangle_n(g, i) sfcgal_triangulated_surface_patch_n((g), (i))
+#define sfcgal_triangulated_surface_add_triangle(g, p) sfcgal_triangulated_surface_add_patch((g), (p))
+#define sfcgal_polyhedral_surface_num_polygons(g) sfcgal_polyhedral_surface_num_patches((g))
+#define sfcgal_polyhedral_surface_polygon_n(g, i) sfcgal_polyhedral_surface_patch_n((g), (i))
+#define sfcgal_geometry_collection_num_geometries(g) sfcgal_geometry_num_geometries((g))
+#define sfcgal_polyhedral_surface_add_polygon(g, p) sfcgal_polyhedral_surface_add_patch((g), (p))
+#endif
+
 static int SFCGAL_type_to_lwgeom_type(sfcgal_geometry_type_t type);
 static POINTARRAY *ptarray_from_SFCGAL(const sfcgal_geometry_t *geom, int force3D);
 static sfcgal_geometry_t *ptarray_to_SFCGAL(const POINTARRAY *pa, int type);
diff --git a/libpgcommon/Makefile.in b/libpgcommon/Makefile.in
index b99b02c89..6f436e764 100644
--- a/libpgcommon/Makefile.in
+++ b/libpgcommon/Makefile.in
@@ -34,8 +34,7 @@ SA_HEADERS = \
 	lwgeom_pg.h \
 	lwgeom_transform.h \
 	lwgeom_cache.h \
-	gserialized_gist.h \
-	pgsql_compat.h
+	gserialized_gist.h
 
 all: libpgcommon.a
 
diff --git a/libpgcommon/common.h b/libpgcommon/common.h
index a84b70c63..681ec8c1c 100644
--- a/libpgcommon/common.h
+++ b/libpgcommon/common.h
@@ -12,7 +12,6 @@
 #ifndef PG_LIBCOMMON_H
 #define PG_LIBCOMMON_H
 
-#include "pgsql_compat.h"
 #include "lwgeom_pg.h"
 #include "lwgeom_transform.h"
 
diff --git a/libpgcommon/lwgeom_pg.h b/libpgcommon/lwgeom_pg.h
index b6f6973c2..151138a8c 100644
--- a/libpgcommon/lwgeom_pg.h
+++ b/libpgcommon/lwgeom_pg.h
@@ -25,7 +25,6 @@
 #include "utils/syscache.h"
 
 #include "liblwgeom.h"
-#include "pgsql_compat.h"
 
 #if POSTGIS_PGSQL_VERSION > 150
 #include "varatt.h"
diff --git a/libpgcommon/pgsql_compat.h b/libpgcommon/pgsql_compat.h
deleted file mode 100644
index 0760e3c63..000000000
--- a/libpgcommon/pgsql_compat.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _PGSQL_COMPAT_H
-#define _PGSQL_COMPAT_H 1
-
-#include "access/tupdesc.h"
-
-/* TupleDescAttr was backported into 9.6.5 but we support any 9.6.X */
-#ifndef TupleDescAttr
-#define TupleDescAttr(tupdesc, i) ((tupdesc)->attrs[(i)])
-#endif
-
-#endif /* _PGSQL_COMPAT_H */
diff --git a/postgis/flatgeobuf.c b/postgis/flatgeobuf.c
index e98d6a65b..9fa5be2b3 100644
--- a/postgis/flatgeobuf.c
+++ b/postgis/flatgeobuf.c
@@ -24,7 +24,6 @@
 
 #include <math.h>
 #include "flatgeobuf.h"
-#include "pgsql_compat.h"
 #include "funcapi.h"
 #include "parser/parse_type.h"
 #include "pgtime.h"
diff --git a/postgis/geobuf.c b/postgis/geobuf.c
index 485902c9f..2c94dd060 100644
--- a/postgis/geobuf.c
+++ b/postgis/geobuf.c
@@ -24,7 +24,6 @@
 
 #include <math.h>
 #include "geobuf.h"
-#include "pgsql_compat.h"
 
 #if defined HAVE_LIBPROTOBUF
 
diff --git a/postgis/gserialized_estimate.c b/postgis/gserialized_estimate.c
index d4e5a7eb9..6ded21987 100644
--- a/postgis/gserialized_estimate.c
+++ b/postgis/gserialized_estimate.c
@@ -1509,7 +1509,11 @@ compute_gserialized_stats_mode(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfu
 		notnull_cnt++;
 
 		/* Give backend a chance of interrupting us */
+#if POSTGIS_PGSQL_VERSION >= 180
+		vacuum_delay_point(true);
+#else
 		vacuum_delay_point();
+#endif
 	}
 
 	/*
@@ -1727,8 +1731,11 @@ compute_gserialized_stats_mode(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfu
 		if ( ! nd_box ) continue; /* Skip Null'ed out hard deviants */
 
 		/* Give backend a chance of interrupting us */
+#if POSTGIS_PGSQL_VERSION >= 180
+		vacuum_delay_point(true);
+#else
 		vacuum_delay_point();
-
+#endif
 		/* Find the cells that overlap with this box and put them into the ND_IBOX */
 		nd_box_overlap(nd_stats, nd_box, &nd_ibox);
 		memset(at, 0, sizeof(int)*ND_DIMS);
diff --git a/postgis/lwgeom_out_geojson.c b/postgis/lwgeom_out_geojson.c
index 31b097fd7..2bd442376 100644
--- a/postgis/lwgeom_out_geojson.c
+++ b/postgis/lwgeom_out_geojson.c
@@ -32,7 +32,6 @@
 #include "lwgeom_log.h"
 #include "liblwgeom.h"
 
-#if POSTGIS_PGSQL_VERSION < 180
 typedef enum					/* type categories for datum_to_json */
 {
 	JSONTYPE_NULL,				/* null, so we didn't bother to identify */
@@ -47,7 +46,6 @@ typedef enum					/* type categories for datum_to_json */
 	JSONTYPE_CAST,				/* something with an explicit cast to JSON */
 	JSONTYPE_OTHER				/* all else */
 } JsonTypeCategory;
-#endif
 
 static void array_dim_to_json(StringInfo result, int dim, int ndims, int *dims,
 				  Datum *vals, bool *nulls, int *valcount,
@@ -68,11 +66,9 @@ static void composite_to_json(Datum composite, StringInfo result,
 static void datum_to_json(Datum val, bool is_null, StringInfo result,
 						  JsonTypeCategory tcategory, Oid outfuncoid,
 						  bool key_scalar);
-#if POSTGIS_PGSQL_VERSION < 180
 static void json_categorize_type(Oid typoid,
 								 JsonTypeCategory *tcategory,
 								 Oid *outfuncoid);
-#endif
 static char * postgis_JsonEncodeDateTime(char *buf, Datum value, Oid typid);
 static int postgis_time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec);
 static int postgis_timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp);
@@ -244,7 +240,6 @@ composite_to_geojson(FunctionCallInfo fcinfo,
  * output function OID.  If the returned category is JSONTYPE_CAST, we
  * return the OID of the type->JSON cast function instead.
  */
-#if POSTGIS_PGSQL_VERSION < 180
 static void
 json_categorize_type(Oid typoid,
 					 JsonTypeCategory *tcategory,
@@ -337,7 +332,7 @@ json_categorize_type(Oid typoid,
 			break;
 	}
 }
-#endif
+
 /*
  * Turn a Datum into JSON text, appending the string to "result".
  *
diff --git a/postgis/mvt.c b/postgis/mvt.c
index 85ee75305..8f6b237f8 100644
--- a/postgis/mvt.c
+++ b/postgis/mvt.c
@@ -29,7 +29,6 @@
 
 #include "mvt.h"
 #include "lwgeom_geos.h"
-#include "pgsql_compat.h"
 
 #ifdef HAVE_LIBPROTOBUF
 #include "utils/jsonb.h"
diff --git a/postgis/postgis_module.c b/postgis/postgis_module.c
index 9e7adb409..a8b31c52b 100644
--- a/postgis/postgis_module.c
+++ b/postgis/postgis_module.c
@@ -25,6 +25,7 @@
 
 #include "postgres.h"
 #include "fmgr.h"
+#include "miscadmin.h"
 #include "executor/executor.h"
 #include "utils/elog.h"
 #include "utils/guc.h"
@@ -45,18 +46,35 @@
  */
 PG_MODULE_MAGIC;
 
-static pqsigfunc coreIntHandler = 0;
-static void handleInterrupt(int sig);
-
+static void interrupt_geos_callback()
+{
 #ifdef WIN32
-static void interruptCallback() {
-  if (UNBLOCKED_SIGNAL_QUEUE())
-    pgwin32_dispatch_queued_signals();
-}
+	if (UNBLOCKED_SIGNAL_QUEUE())
+		pgwin32_dispatch_queued_signals();
 #endif
+	/*
+	 * If PgSQL global flags show interrupt,
+	 * flip the pending flag in GEOS
+	 * to end current query.
+	 */
+	if (QueryCancelPending || ProcDiePending)
+		GEOS_interruptRequest();
+}
 
-static ExecutorStart_hook_type onExecutorStartPrev = NULL;
-static void onExecutorStart(QueryDesc *queryDesc, int eflags);
+static void interrupt_liblwgeom_callback()
+{
+#ifdef WIN32
+	if (UNBLOCKED_SIGNAL_QUEUE())
+		pgwin32_dispatch_queued_signals();
+#endif
+	/*
+	 * If PgSQL global flags show interrupt,
+	 * flip the pending flag in liblwgeom
+	 * to end current query.
+	 */
+	if (QueryCancelPending || ProcDiePending)
+		lwgeom_request_interrupt();
+}
 
 /*
 * Pass proj error message out via the PostgreSQL logging
@@ -80,24 +98,23 @@ void _PG_init(void);
 void
 _PG_init(void)
 {
-  coreIntHandler = pqsignal(SIGINT, handleInterrupt);
 
-#ifdef WIN32
-  GEOS_interruptRegisterCallback(interruptCallback);
-  lwgeom_register_interrupt_callback(interruptCallback);
-#endif
+	/*
+	 * Hook up interrupt checking to call back here
+	 * and examine the PgSQL interrupt state variables
+	 */
+	GEOS_interruptRegisterCallback(interrupt_geos_callback);
+	lwgeom_register_interrupt_callback(interrupt_liblwgeom_callback);
 
-  /* install PostgreSQL handlers */
-  pg_install_lwgeom_handlers();
 
-  /* pass proj messages through the pgsql error handler */
+	/* Install PostgreSQL error/memory handlers */
+	pg_install_lwgeom_handlers();
+
 #if POSTGIS_PROJ_VERSION > 60
-  proj_log_func(NULL, NULL, pjLogFunction);
+	/* Pass proj messages through the pgsql error handler */
+	proj_log_func(NULL, NULL, pjLogFunction);
 #endif
 
-  /* setup hooks */
-  onExecutorStartPrev = ExecutorStart_hook;
-  ExecutorStart_hook = onExecutorStart;
 }
 
 /*
@@ -107,54 +124,8 @@ void _PG_fini(void);
 void
 _PG_fini(void)
 {
-  elog(NOTICE, "Goodbye from PostGIS %s", POSTGIS_VERSION);
-  pqsignal(SIGINT, coreIntHandler);
-
-  /* restore original hooks */
-  ExecutorStart_hook = onExecutorStartPrev;
+	elog(NOTICE, "Goodbye from PostGIS %s", POSTGIS_VERSION);
 }
 
 
-static void
-handleInterrupt(int sig)
-{
-  /* NOTE: printf here would be dangerous, see
-   * https://trac.osgeo.org/postgis/ticket/3644
-   *
-   * TODO: block interrupts during execution, to fix the problem
-   */
-  /* printf("Interrupt requested\n"); fflush(stdout); */
 
-  GEOS_interruptRequest();
-
-#ifdef HAVE_LIBPROTOBUF
-	/* Taking out per #5385 crash */
-  //lwgeom_wagyu_interruptRequest();
-#endif
-
-  /* request interruption of liblwgeom as well */
-  lwgeom_request_interrupt();
-
-  if ( coreIntHandler ) {
-    (*coreIntHandler)(sig);
-  }
-}
-
-static void onExecutorStart(QueryDesc *queryDesc, int eflags) {
-    /* cancel interrupt requests */
-
-    GEOS_interruptCancel();
-
-#ifdef HAVE_LIBPROTOBUF
-		/* Taking out per #5385 crash */
-    //lwgeom_wagyu_interruptReset();
-#endif
-
-    lwgeom_cancel_interrupt();
-
-    if (onExecutorStartPrev) {
-        (*onExecutorStartPrev)(queryDesc, eflags);
-    } else {
-        standard_ExecutorStart(queryDesc, eflags);
-    }
-}
diff --git a/raster/rt_pg/rtpostgis.c b/raster/rt_pg/rtpostgis.c
index 7ae30b93e..44af11c79 100644
--- a/raster/rt_pg/rtpostgis.c
+++ b/raster/rt_pg/rtpostgis.c
@@ -267,7 +267,7 @@ rt_pg_options(const char* varname)
 /*  GDAL allowed config options for VSI filesystems */
 /* ---------------------------------------------------------------- */
 
-stringlist_t *vsi_option_stringlist = NULL;
+static stringlist_t *vsi_option_stringlist = NULL;
 
 
 #if POSTGIS_GDAL_VERSION < 23
@@ -646,48 +646,6 @@ rtpg_assignHookEnableOutDBRasters(bool enable, void *extra) {
 }
 
 
-
-/*
-* Machinery for intercepting the system SIGINT
-* handler so we can cancel long-running GDAL operations
-* via the progress handlers.
-*/
-static pqsigfunc coreIntHandler = 0;
-
-#ifdef WIN32
-static void interruptCallback() {
-  if (UNBLOCKED_SIGNAL_QUEUE())
-    pgwin32_dispatch_queued_signals();
-}
-#endif
-
-
-/*
-* This is the interrupt capture for this module.
-* Before handing off the signal to the core, it
-* sets the interrupt flag for currently running
-* functions.
-*/
-static void
-handleInterrupt(int sig)
-{
-	/*
-	* NOTE: printf here would be dangerous, see
-	* https://trac.osgeo.org/postgis/ticket/3644
-	*/
-	// printf("postgis_raster interrupt requested\n"); fflush(stdout);
-
-	/* Request interruption of liblwgeom as well */
-	lwgeom_request_interrupt();
-
-	/* Pass control into the usual core handler */
-	if (coreIntHandler) {
-		(*coreIntHandler)(sig);
-	}
-}
-
-
-
 /* Module load callback */
 void
 _PG_init(void) {
@@ -695,15 +653,6 @@ _PG_init(void) {
 	bool boot_postgis_enable_outdb_rasters = false;
 	MemoryContext old_context;
 
-	/* Set up interrupt capture */
-	coreIntHandler = pqsignal(SIGINT, handleInterrupt);
-
-#ifdef WIN32
- 	GEOS_interruptRegisterCallback(interruptCallback);
- 	lwgeom_register_interrupt_callback(interruptCallback);
-#endif
-
-
 	/*
 	 * Change to context for memory allocation calls like palloc() in the
 	 * extension initialization routine
@@ -867,9 +816,6 @@ _PG_fini(void) {
 
 	elog(NOTICE, "Goodbye from PostGIS Raster %s", POSTGIS_VERSION);
 
-	/* Return SIGINT handling to core */
-	pqsignal(SIGINT, coreIntHandler);
-
 	/* Clean up */
 	pfree(env_postgis_gdal_enabled_drivers);
 	pfree(boot_postgis_gdal_enabled_drivers);
diff --git a/sfcgal/lwgeom_sfcgal.c b/sfcgal/lwgeom_sfcgal.c
index e85e7ee9a..f1888c6bb 100644
--- a/sfcgal/lwgeom_sfcgal.c
+++ b/sfcgal/lwgeom_sfcgal.c
@@ -40,71 +40,14 @@
  * This is required for builds against pgsql
  */
 PG_MODULE_MAGIC;
-#ifdef WIN32
-static void interruptCallback() {
-  if (UNBLOCKED_SIGNAL_QUEUE())
-    pgwin32_dispatch_queued_signals();
-}
-#endif
-
-static pqsigfunc coreIntHandler = 0;
-static void handleInterrupt(int sig);
-
-/*
- * Module load callback
- */
-void _PG_init(void);
-void
-_PG_init(void)
-{
-
-  coreIntHandler = pqsignal(SIGINT, handleInterrupt);
-
-#ifdef WIN32
-  GEOS_interruptRegisterCallback(interruptCallback);
-  lwgeom_register_interrupt_callback(interruptCallback);
-#endif
-
-    /* install PostgreSQL handlers */
-    pg_install_lwgeom_handlers();
-}
-
-/*
- * Module unload callback
- */
-void _PG_fini(void);
-void
-_PG_fini(void)
-{
-  elog(NOTICE, "Goodbye from PostGIS SFCGAL %s", POSTGIS_VERSION);
-  pqsignal(SIGINT, coreIntHandler);
-}
 
 
-static void
-handleInterrupt(int sig)
-{
-  /* NOTE: printf here would be dangerous, see
-   * https://trac.osgeo.org/postgis/ticket/3644
-   *
-   * TODO: block interrupts during execution, to fix the problem
-   */
-  /* printf("Interrupt requested\n"); fflush(stdout); */
-
-  /* request interruption of liblwgeom as well */
-  lwgeom_request_interrupt();
-
-  if ( coreIntHandler ) {
-    (*coreIntHandler)(sig);
-  }
-}
-
-Datum postgis_sfcgal_version(PG_FUNCTION_ARGS);
 
+/* Prototypes */
 #if POSTGIS_SFCGAL_VERSION >= 10400
 Datum postgis_sfcgal_full_version(PG_FUNCTION_ARGS);
 #endif
-
+Datum postgis_sfcgal_version(PG_FUNCTION_ARGS);
 Datum sfcgal_from_ewkt(PG_FUNCTION_ARGS);
 Datum sfcgal_area3D(PG_FUNCTION_ARGS);
 Datum sfcgal_intersection3D(PG_FUNCTION_ARGS);
@@ -129,9 +72,29 @@ Datum sfcgal_optimalalphashape(PG_FUNCTION_ARGS);
 
 GSERIALIZED *geometry_serialize(LWGEOM *lwgeom);
 char *text_to_cstring(const text *textptr);
+void _PG_init(void);
+void _PG_fini(void);
 
 static int __sfcgal_init = 0;
 
+
+/* Module load callback */
+void
+_PG_init(void)
+{
+	/* install PostgreSQL handlers */
+	pg_install_lwgeom_handlers();
+	elog(DEBUG1, "PostGIS SFCGAL %s loaded", POSTGIS_VERSION);
+}
+
+
+/* Module unload callback */
+void
+_PG_fini(void)
+{
+	elog(NOTICE, "Goodbye from PostGIS SFCGAL %s", POSTGIS_VERSION);
+}
+
 void
 sfcgal_postgis_init(void)
 {
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 7acff22f9..ede533fba 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -32,7 +32,6 @@
 /*#define POSTGIS_DEBUG_LEVEL 1*/
 #include "lwgeom_log.h"
 #include "lwgeom_pg.h"
-#include "pgsql_compat.h"
 
 #include <stdarg.h>
 
@@ -53,7 +52,7 @@
  */
 PG_MODULE_MAGIC;
 
-LWT_BE_IFACE* be_iface;
+static LWT_BE_IFACE* be_iface;
 
 /*
  * Private data we'll use for this backend
@@ -76,7 +75,7 @@ struct LWT_BE_DATA_T
   int topoLoadFailMessageFlavor; /* 0:sql, 1:AddPoint */
 };
 
-LWT_BE_DATA be_data;
+static LWT_BE_DATA be_data;
 
 struct LWT_BE_TOPOLOGY_T
 {

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

Summary of changes:
 NEWS                           |   1 +
 liblwgeom/lwgeom_sfcgal.c      |  10 ++++
 libpgcommon/Makefile.in        |   3 +-
 libpgcommon/common.h           |   1 -
 libpgcommon/lwgeom_pg.h        |   1 -
 libpgcommon/pgsql_compat.h     |  11 -----
 postgis/flatgeobuf.c           |   1 -
 postgis/geobuf.c               |   1 -
 postgis/gserialized_estimate.c |   9 +++-
 postgis/lwgeom_out_geojson.c   |   7 +--
 postgis/mvt.c                  |   1 -
 postgis/postgis_module.c       | 107 +++++++++++++++--------------------------
 raster/rt_pg/rtpostgis.c       |  56 +--------------------
 sfcgal/lwgeom_sfcgal.c         |  81 +++++++++----------------------
 topology/postgis_topology.c    |   5 +-
 15 files changed, 85 insertions(+), 210 deletions(-)
 delete mode 100644 libpgcommon/pgsql_compat.h


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list