[SCM] PostGIS branch master updated. 3.6.0beta1-31-gd0ea36670

git at osgeo.org git at osgeo.org
Thu Aug 14 00:59:14 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, master has been updated
       via  d0ea36670bd84f5e38a5e1a568b23ba0c55bb713 (commit)
      from  1149545861030eecb73453c6c5a12bfaa3f40d59 (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 d0ea36670bd84f5e38a5e1a568b23ba0c55bb713
Author: Laurențiu Nicola <lnicola at dend.ro>
Date:   Tue Jul 29 21:05:25 2025 +0300

    topology: allocate the result in the upper executor memory context in ST_GetFaceGeometry

diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 0473bbdd5..4a8b82438 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -4073,7 +4073,7 @@ Datum ST_GetFaceGeometry(PG_FUNCTION_ARGS)
   LWGEOM *lwgeom;
   LWT_TOPOLOGY *topo;
   GSERIALIZED *geom;
-  MemoryContext old_context;
+  MemoryContext old_context, spi_context;
 
   if ( PG_ARGISNULL(0) || PG_ARGISNULL(1) )
   {
@@ -4087,8 +4087,10 @@ Datum ST_GetFaceGeometry(PG_FUNCTION_ARGS)
 
   face_id = PG_GETARG_INT64(1) ;
 
+  old_context = CurrentMemoryContext;
   if ( SPI_OK_CONNECT != SPI_connect() )
   {
+    pfree(toponame);
     lwpgerror("Could not connect to SPI");
     PG_RETURN_NULL();
   }
@@ -4115,10 +4117,11 @@ Datum ST_GetFaceGeometry(PG_FUNCTION_ARGS)
   }
 
   /* Serialize in upper memory context (outside of SPI) */
-  /* TODO: use a narrower context to switch to ? */
-  old_context = MemoryContextSwitchTo( TopTransactionContext );
+  spi_context = MemoryContextSwitchTo(old_context);
   geom = geometry_serialize(lwgeom);
-  MemoryContextSwitchTo(old_context);
+  MemoryContextSwitchTo(spi_context);
+
+  /* No need to free lwgeom here because it will go away with the SPI context */
 
   SPI_finish();
 

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

Summary of changes:
 topology/postgis_topology.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list