[SCM] PostGIS branch master updated. 3.4.0rc1-1003-gd0193e2bb

git at osgeo.org git at osgeo.org
Sun Mar 10 18:02:18 PDT 2024


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  d0193e2bbd67f725d27e6bab7123bac71dfd576f (commit)
       via  cbaa183be5ad87d4ed96d947a0e03a063e889e17 (commit)
      from  dd0ff5257f8fa4a5a90151ef835910aec3fe8ed8 (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 d0193e2bbd67f725d27e6bab7123bac71dfd576f
Author: Regina Obe <lr at pcorp.us>
Date:   Sun Mar 10 21:00:27 2024 -0400

    FIX for PostgreSQL 17 regression failure on spgist
    For script installs, don't rely on search_path
    to determine schema postgis is installed.
    
    Closes #5687 for PostGIS 3.5.0

diff --git a/NEWS b/NEWS
index 4a9b8e8b0..a828e3583 100644
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,8 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.5.0+ is needed.
   - GH-760, postgis_sfcgal: CG_Intersection, CG_3DIntersects, CG_Intersects,
             CG_Difference, CG_Union (and aggregate), CG_Triangulate, CG_Area,
             CG_3DDistance, CG_Distance (Loïc Bartoletti)
+  - #5687, Don't rely on search_path to determine postgis schema
+           Fix for PG17 security change (Regina Obe)
 
 * Enhancements *
 
diff --git a/libpgcommon/lwgeom_pg.c b/libpgcommon/lwgeom_pg.c
index 4a5a99d4f..331f8cb78 100644
--- a/libpgcommon/lwgeom_pg.c
+++ b/libpgcommon/lwgeom_pg.c
@@ -100,23 +100,52 @@ postgis_get_extension_schema(Oid ext_oid)
 static Oid
 postgis_get_full_version_schema()
 {
-	const char* proname = "postgis_full_version";
+	const char* query =  "SELECT pronamespace "
+		" FROM pg_catalog.pg_proc "
+		" WHERE proname = 'postgis_full_version'";
+	int spi_result;
+	Oid funcNameSpaceOid;
 
-	#if POSTGIS_PGSQL_VERSION < 160
-	List* names = stringToQualifiedNameList(proname);
-	#else
-	List* names = stringToQualifiedNameList(proname, NULL);
-	#endif
-
-	#if POSTGIS_PGSQL_VERSION < 140
-	FuncCandidateList clist = FuncnameGetCandidates(names, -1, NIL, false, false, false);
-	#else
-	FuncCandidateList clist = FuncnameGetCandidates(names, -1, NIL, false, false, false, false);
-	#endif
-	if (!clist)
+	if (SPI_OK_CONNECT != SPI_connect())
+	{
+		elog(ERROR, "%s: could not connect to SPI manager", __func__);
 		return InvalidOid;
+	}
 
-	return get_func_namespace(clist->oid);
+	/* Execute the query, noting the readonly status of this SQL */
+	spi_result = SPI_execute(query, TRUE, 0);
+
+	if (spi_result != SPI_OK_SELECT || SPI_tuptable == NULL){
+		elog(ERROR, "%s: error executing query %d", __func__, spi_result);
+		SPI_finish();
+		return InvalidOid;
+	}
+
+	/* Read back the OID of the function namespace, only if one result returned
+	  If more than one, then this install is f..cked.
+		If 0 then postgis is not installed at all */
+	if (SPI_processed == 1)
+	{
+		TupleDesc tupdesc;
+		SPITupleTable *tuptable = SPI_tuptable;
+		HeapTuple tuple;
+
+		tupdesc = SPI_tuptable->tupdesc;
+		tuptable = SPI_tuptable;
+		tuple = tuptable->vals[0];
+		funcNameSpaceOid = atoi(SPI_getvalue(tuple, tupdesc, 1));
+
+		if (SPI_tuptable) SPI_freetuptable(tuptable);
+		SPI_finish();
+	}
+	else
+	{
+		elog(ERROR, "Cannot determine install schema of postgis_full_version function.");
+		SPI_finish();
+		return InvalidOid;
+	}
+
+	return funcNameSpaceOid;
 }
 
 

commit cbaa183be5ad87d4ed96d947a0e03a063e889e17
Author: Regina Obe <lr at pcorp.us>
Date:   Sun Mar 10 13:38:25 2024 -0400

    Get rid of rc paths and add missing released paths

diff --git a/extensions/upgradeable_versions.mk b/extensions/upgradeable_versions.mk
index 4b58b767d..370e8075b 100644
--- a/extensions/upgradeable_versions.mk
+++ b/extensions/upgradeable_versions.mk
@@ -91,6 +91,4 @@ UPGRADEABLE_VERSIONS = \
 	3.3.3 \
 	3.3.4 \
 	3.4.0 \
-	3.4.0rc1 \
-	3.4.0rc2 \
-	3.4.0dev
+	3.4.1dev

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

Summary of changes:
 NEWS                               |  2 ++
 extensions/upgradeable_versions.mk |  4 +--
 libpgcommon/lwgeom_pg.c            | 59 ++++++++++++++++++++++++++++----------
 3 files changed, 47 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list