[postgis-tickets] [SCM] PostGIS branch stable-3.0 updated. 3.0.2-9-gcb66c8b

git at osgeo.org git at osgeo.org
Mon Oct 5 02:29:04 PDT 2020


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.0 has been updated
       via  cb66c8b17428944dfccb5622db65ae3d52b19a07 (commit)
      from  f078f3d0ec0345233f33e5b005d979460b12810e (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 cb66c8b17428944dfccb5622db65ae3d52b19a07
Author: Raúl Marín <git at rmr.ninja>
Date:   Fri Oct 2 16:09:45 2020 +0200

    Ensure all functions using postgis_oid initialize the internal cache
    
    Closes #4739

diff --git a/NEWS b/NEWS
index c10662b..5350f53 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,12 @@
 PostGIS 3.0.3dev
 2020/xx/xx
+
 * Bug Fixes and Enhancements *
   - #4742 tiger geocoder reverted to 2018 version on tiger upgrade
   - #4757, Handle line collapse due to snap-to-existing node (Sandro Santilli)
-	- #4719, Fail fast when srids don't match ST_Intersection(geometry,raster)
+  - #4719, Fail fast when srids don't match ST_Intersection(geometry,raster)
            Also schema qualify calls in function. (Regina Obe)
+  - #4739, Ensure all functions using postgis_oid initialize the internal cache (Raúl Marín)
 
 PostGIS 3.0.2
 2020/08/15
diff --git a/postgis/gserialized_estimate.c b/postgis/gserialized_estimate.c
index fa4700e..6f55494 100644
--- a/postgis/gserialized_estimate.c
+++ b/postgis/gserialized_estimate.c
@@ -2303,6 +2303,9 @@ Datum gserialized_estimated_extent(PG_FUNCTION_ARGS)
 	bool only_parent = false;
 	int key_type;
 
+	/* We need to initialize the internal cache to access it later via postgis_oid() */
+	postgis_initialize_cache(fcinfo);
+
 	if ( PG_NARGS() == 4 )
 	{
 		nsp = text_to_cstring(PG_GETARG_TEXT_P(0));
@@ -2565,8 +2568,12 @@ Datum _postgis_gserialized_index_extent(PG_FUNCTION_ARGS)
 	int key_type;
 	Oid tbl_oid = PG_GETARG_DATUM(0);
 	text *col = PG_GETARG_TEXT_P(1);
+	Oid idx_oid;
+
+	/* We need to initialize the internal cache to access it later via postgis_oid() */
+	postgis_initialize_cache(fcinfo);
 
-	Oid idx_oid = table_get_spatial_index(tbl_oid, col, &key_type);
+	idx_oid = table_get_spatial_index(tbl_oid, col, &key_type);
 	if (!idx_oid)
 		PG_RETURN_NULL();
 
diff --git a/postgis/gserialized_spgist_2d.c b/postgis/gserialized_spgist_2d.c
index fc60e18..3957075 100644
--- a/postgis/gserialized_spgist_2d.c
+++ b/postgis/gserialized_spgist_2d.c
@@ -291,6 +291,7 @@ PGDLLEXPORT Datum gserialized_spgist_config_2d(PG_FUNCTION_ARGS)
 {
 	spgConfigOut *cfg = (spgConfigOut *)PG_GETARG_POINTER(1);
 	Oid boxoid = InvalidOid;
+	/* We need to initialize the internal cache to access it later via postgis_oid() */
 	postgis_initialize_cache(fcinfo);
 	boxoid = postgis_oid(BOX2DFOID);
 
diff --git a/postgis/gserialized_spgist_3d.c b/postgis/gserialized_spgist_3d.c
index b417baa..61953fa 100644
--- a/postgis/gserialized_spgist_3d.c
+++ b/postgis/gserialized_spgist_3d.c
@@ -374,6 +374,7 @@ PGDLLEXPORT Datum gserialized_spgist_config_3d(PG_FUNCTION_ARGS)
 	spgConfigOut *cfg = (spgConfigOut *)PG_GETARG_POINTER(1);
 
 	Oid boxoid = InvalidOid;
+	/* We need to initialize the internal cache to access it later via postgis_oid() */
 	postgis_initialize_cache(fcinfo);
 	boxoid = postgis_oid(BOX3DOID);
 
diff --git a/postgis/gserialized_supportfn.c b/postgis/gserialized_supportfn.c
index d783337..ce53816 100644
--- a/postgis/gserialized_supportfn.c
+++ b/postgis/gserialized_supportfn.c
@@ -279,6 +279,12 @@ Datum postgis_index_supportfn(PG_FUNCTION_ARGS)
 	Node *rawreq = (Node *) PG_GETARG_POINTER(0);
 	Node *ret = NULL;
 
+	/* The support function need the cache to be populated to know what the type Oids are.
+	 * Otherwise it will need look them up dynamically, which only works in the schema where Postgis
+	 * is installed is part of the search path (Trac #4739)
+	 */
+	postgis_initialize_cache(fcinfo);
+
 	if (IsA(rawreq, SupportRequestSelectivity))
 	{
 		SupportRequestSelectivity *req = (SupportRequestSelectivity *) rawreq;
diff --git a/postgis/lwgeom_out_geobuf.c b/postgis/lwgeom_out_geobuf.c
index 5db6c8e..f375397 100644
--- a/postgis/lwgeom_out_geobuf.c
+++ b/postgis/lwgeom_out_geobuf.c
@@ -52,6 +52,9 @@ Datum pgis_asgeobuf_transfn(PG_FUNCTION_ARGS)
 	MemoryContext aggcontext;
 	struct geobuf_agg_context *ctx;
 
+	/* We need to initialize the internal cache to access it later via postgis_oid() */
+	postgis_initialize_cache(fcinfo);
+
 	if (!AggCheckCallContext(fcinfo, &aggcontext))
 		elog(ERROR, "pgis_asgeobuf_transfn: called in non-aggregate context");
 	MemoryContextSwitchTo(aggcontext);
diff --git a/postgis/lwgeom_out_geojson.c b/postgis/lwgeom_out_geojson.c
index 4d82148..5db0d0b 100644
--- a/postgis/lwgeom_out_geojson.c
+++ b/postgis/lwgeom_out_geojson.c
@@ -89,6 +89,7 @@ ST_AsGeoJsonRow(PG_FUNCTION_ARGS)
 	Oid geom_oid = InvalidOid;
 	Oid geog_oid = InvalidOid;
 
+	/* We need to initialize the internal cache to access it later via postgis_oid() */
 	postgis_initialize_cache(fcinfo);
 	geom_oid = postgis_oid(GEOMETRYOID);
 	geog_oid = postgis_oid(GEOGRAPHYOID);
diff --git a/postgis/lwgeom_out_mvt.c b/postgis/lwgeom_out_mvt.c
index f1c72af..f46ec42 100644
--- a/postgis/lwgeom_out_mvt.c
+++ b/postgis/lwgeom_out_mvt.c
@@ -132,6 +132,9 @@ Datum pgis_asmvt_transfn(PG_FUNCTION_ARGS)
 	MemoryContext aggcontext;
 	mvt_agg_context *ctx;
 
+	/* We need to initialize the internal cache to access it later via postgis_oid() */
+	postgis_initialize_cache(fcinfo);
+
 	if (!AggCheckCallContext(fcinfo, &aggcontext))
 		elog(ERROR, "%s called in non-aggregate context", __func__);
 	MemoryContextSwitchTo(aggcontext);

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

Summary of changes:
 NEWS                            | 4 +++-
 postgis/gserialized_estimate.c  | 9 ++++++++-
 postgis/gserialized_spgist_2d.c | 1 +
 postgis/gserialized_spgist_3d.c | 1 +
 postgis/gserialized_supportfn.c | 6 ++++++
 postgis/lwgeom_out_geobuf.c     | 3 +++
 postgis/lwgeom_out_geojson.c    | 1 +
 postgis/lwgeom_out_mvt.c        | 3 +++
 8 files changed, 26 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list