[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.1-11-g6225a9a67

git at osgeo.org git at osgeo.org
Tue Apr 5 19:07:02 PDT 2022


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.2 has been updated
       via  6225a9a67e2bdaa749f1606389ea5af4e3b85099 (commit)
      from  15fab4096e99c44b7e17c0ded22e59fddb09a5c6 (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 6225a9a67e2bdaa749f1606389ea5af4e3b85099
Author: Regina Obe <lr at pcorp.us>
Date:   Tue Apr 5 22:05:57 2022 -0400

    Fix compile against PG15
    1. json. json and jsonb are now keywords so must be quoted as function names
    2. json functions now exposed in api so exclude from code for PG15.
    Closes #5123 for PostGIS 3.2

diff --git a/NEWS b/NEWS
index bef5b6d51..b6d5c1ed7 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ PostGIS 3.2.2dev
            at the getClosestEdge step (Sandro Santilli)
   - #5091, Fix --without-protobuf builds (Tobias Bussmann)
   - #5100, Don't use pg_atoi (removed in PG15) (Laurenz Albe)
+  - #5123, Support for PG15 (JSON funcs exposed) (Regina Obe)
 
 
 PostGIS 3.2.1
diff --git a/postgis/lwgeom_out_geojson.c b/postgis/lwgeom_out_geojson.c
index fcedef70f..44489f656 100644
--- a/postgis/lwgeom_out_geojson.c
+++ b/postgis/lwgeom_out_geojson.c
@@ -32,7 +32,7 @@
 #include "lwgeom_log.h"
 #include "liblwgeom.h"
 
-
+#if POSTGIS_PGSQL_VERSION < 150
 typedef enum					/* type categories for datum_to_json */
 {
 	JSONTYPE_NULL,				/* null, so we didn't bother to identify */
@@ -47,6 +47,7 @@ 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,
@@ -67,9 +68,11 @@ 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 < 150
 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);
@@ -231,6 +234,7 @@ composite_to_geojson(FunctionCallInfo fcinfo,
  * json.c from the Postgres source tree as of 2019-03-28.
  * It would be far better if these were exported from the
  * backend so we could just use them here. Maybe someday.
+ * Sequel: 2022-04-04 That some day finally came in PG15
  */
 
 /*
@@ -240,6 +244,7 @@ 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 < 150
 static void
 json_categorize_type(Oid typoid,
 					 JsonTypeCategory *tcategory,
@@ -332,7 +337,7 @@ json_categorize_type(Oid typoid,
 			break;
 	}
 }
-
+#endif
 /*
  * Turn a Datum into JSON text, appending the string to "result".
  *
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index c214abeb2..cceacf1c0 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -4840,23 +4840,23 @@ CREATE OR REPLACE FUNCTION ST_AsGeoJson(r record, geom_column text DEFAULT '', m
 	_COST_MEDIUM;
 
 -- Availability: 3.0.0
-CREATE OR REPLACE FUNCTION json(geometry)
+CREATE OR REPLACE FUNCTION "json"(geometry)
 	RETURNS json
 	AS 'MODULE_PATHNAME','geometry_to_json'
 	LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
 	_COST_MEDIUM;
 
 -- Availability: 3.0.0
-CREATE OR REPLACE FUNCTION jsonb(geometry)
+CREATE OR REPLACE FUNCTION "jsonb"(geometry)
 	RETURNS jsonb
 	AS 'MODULE_PATHNAME','geometry_to_jsonb'
 	LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
 	_COST_MEDIUM;
 
 -- Availability: 3.0.0
-CREATE CAST (geometry AS json) WITH FUNCTION json(geometry);
+CREATE CAST (geometry AS json) WITH FUNCTION "json"(geometry);
 -- Availability: 3.0.0
-CREATE CAST (geometry AS jsonb) WITH FUNCTION jsonb(geometry);
+CREATE CAST (geometry AS jsonb) WITH FUNCTION "jsonb"(geometry);
 
 -----------------------------------------------------------------------
 -- Mapbox Vector Tile OUTPUT

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

Summary of changes:
 NEWS                         | 1 +
 postgis/lwgeom_out_geojson.c | 9 +++++++--
 postgis/postgis.sql.in       | 8 ++++----
 3 files changed, 12 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list