[postgis-tickets] r16443 - Remove the pgis_abs dummy type and replace with use of 'internal' type.

Paul Ramsey pramsey at cleverelephant.ca
Mon Mar 5 06:14:49 PST 2018


Author: pramsey
Date: 2018-03-05 06:14:49 -0800 (Mon, 05 Mar 2018)
New Revision: 16443

Modified:
   trunk/postgis/legacy.sql.in
   trunk/postgis/lwgeom_accum.c
   trunk/postgis/postgis.sql.in
Log:
Remove the pgis_abs dummy type and replace with use of 'internal' type.
Closes #4035


Modified: trunk/postgis/legacy.sql.in
===================================================================
--- trunk/postgis/legacy.sql.in	2018-03-03 09:11:46 UTC (rev 16442)
+++ trunk/postgis/legacy.sql.in	2018-03-05 14:14:49 UTC (rev 16443)
@@ -1273,7 +1273,7 @@
 CREATE AGGREGATE makeline (
 	BASETYPE = geometry,
 	SFUNC = pgis_geometry_accum_transfn,
-	STYPE = pgis_abs,
+	STYPE = internal,
 	FINALFUNC = pgis_geometry_makeline_finalfn
 	);
 
@@ -1904,7 +1904,7 @@
 CREATE AGGREGATE accum (
 	sfunc = pgis_geometry_accum_transfn,
 	basetype = geometry,
-	stype = pgis_abs,
+	stype = internal,
 	finalfunc = pgis_geometry_accum_finalfn
 	);
 -- Deprecation in 1.2.3

Modified: trunk/postgis/lwgeom_accum.c
===================================================================
--- trunk/postgis/lwgeom_accum.c	2018-03-03 09:11:46 UTC (rev 16442)
+++ trunk/postgis/lwgeom_accum.c	2018-03-05 14:14:49 UTC (rev 16443)
@@ -49,8 +49,6 @@
 Datum pgis_geometry_makeline_finalfn(PG_FUNCTION_ARGS);
 Datum pgis_geometry_clusterintersecting_finalfn(PG_FUNCTION_ARGS);
 Datum pgis_geometry_clusterwithin_finalfn(PG_FUNCTION_ARGS);
-Datum pgis_abs_in(PG_FUNCTION_ARGS);
-Datum pgis_abs_out(PG_FUNCTION_ARGS);
 
 /* External prototypes */
 Datum pgis_union_geometry_array(PG_FUNCTION_ARGS);
@@ -88,29 +86,7 @@
 pgis_abs;
 
 
-
 /**
-** We're never going to use this type externally so the in/out
-** functions are dummies.
-*/
-PG_FUNCTION_INFO_V1(pgis_abs_in);
-Datum
-pgis_abs_in(PG_FUNCTION_ARGS)
-{
-	ereport(ERROR,(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-	               errmsg("function %s not implemented", __func__)));
-	PG_RETURN_POINTER(NULL);
-}
-PG_FUNCTION_INFO_V1(pgis_abs_out);
-Datum
-pgis_abs_out(PG_FUNCTION_ARGS)
-{
-	ereport(ERROR,(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-	               errmsg("function %s not implemented", __func__)));
-	PG_RETURN_POINTER(NULL);
-}
-
-/**
 ** The transfer function hooks into the PostgreSQL accumArrayResult()
 ** function (present since 8.0) to build an array in a side memory
 ** context.
@@ -139,6 +115,7 @@
 
 	if ( PG_ARGISNULL(0) )
 	{
+		MemoryContext old = MemoryContextSwitchTo(aggcontext);
 		p = (pgis_abs*) palloc(sizeof(pgis_abs));
 		p->a = NULL;
 		p->data = (Datum) NULL;
@@ -147,12 +124,11 @@
 		{
 			Datum argument = PG_GETARG_DATUM(2);
 			Oid dataOid = get_fn_expr_argtype(fcinfo->flinfo, 2);
-			MemoryContext old = MemoryContextSwitchTo(aggcontext);
 
 			p->data = datumCopy(argument, get_typbyval(dataOid), get_typlen(dataOid));
 
-			MemoryContextSwitchTo(old);
 		}
+		MemoryContextSwitchTo(old);
 	}
 	else
 	{

Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in	2018-03-03 09:11:46 UTC (rev 16442)
+++ trunk/postgis/postgis.sql.in	2018-03-05 14:14:49 UTC (rev 16443)
@@ -3839,85 +3839,63 @@
 	stype = geometry
 	);
 
---
--- pgis_abs
--- Container type to hold the ArrayBuildState pointer as it passes through
--- the geometry array accumulation aggregate.
---
-CREATE OR REPLACE FUNCTION pgis_abs_in(cstring)
-	RETURNS pgis_abs
-	AS 'MODULE_PATHNAME'
-	LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
 
-CREATE OR REPLACE FUNCTION pgis_abs_out(pgis_abs)
-	RETURNS cstring
-	AS 'MODULE_PATHNAME'
-	LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
 -- Availability: 1.4.0
-CREATE TYPE pgis_abs (
-	internallength = 16,
-	input = pgis_abs_in,
-	output = pgis_abs_out,
-	alignment = double
-);
-
--- Availability: 1.4.0
-CREATE OR REPLACE FUNCTION pgis_geometry_accum_transfn(pgis_abs, geometry)
-	RETURNS pgis_abs
+CREATE OR REPLACE FUNCTION pgis_geometry_accum_transfn(internal, geometry)
+	RETURNS internal
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 2.2
-CREATE OR REPLACE FUNCTION pgis_geometry_accum_transfn(pgis_abs, geometry, float8)
-	RETURNS pgis_abs
+CREATE OR REPLACE FUNCTION pgis_geometry_accum_transfn(internal, geometry, float8)
+	RETURNS internal
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 2.3
-CREATE OR REPLACE FUNCTION pgis_geometry_accum_transfn(pgis_abs, geometry, float8, int)
-	RETURNS pgis_abs
+CREATE OR REPLACE FUNCTION pgis_geometry_accum_transfn(internal, geometry, float8, int)
+	RETURNS internal
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 1.4.0
-CREATE OR REPLACE FUNCTION pgis_geometry_accum_finalfn(pgis_abs)
+CREATE OR REPLACE FUNCTION pgis_geometry_accum_finalfn(internal)
 	RETURNS geometry[]
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 1.4.0
-CREATE OR REPLACE FUNCTION pgis_geometry_union_finalfn(pgis_abs)
+CREATE OR REPLACE FUNCTION pgis_geometry_union_finalfn(internal)
 	RETURNS geometry
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 1.4.0
-CREATE OR REPLACE FUNCTION pgis_geometry_collect_finalfn(pgis_abs)
+CREATE OR REPLACE FUNCTION pgis_geometry_collect_finalfn(internal)
 	RETURNS geometry
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 1.4.0
-CREATE OR REPLACE FUNCTION pgis_geometry_polygonize_finalfn(pgis_abs)
+CREATE OR REPLACE FUNCTION pgis_geometry_polygonize_finalfn(internal)
 	RETURNS geometry
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 2.2
-CREATE OR REPLACE FUNCTION pgis_geometry_clusterintersecting_finalfn(pgis_abs)
+CREATE OR REPLACE FUNCTION pgis_geometry_clusterintersecting_finalfn(internal)
 	RETURNS geometry[]
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 2.2
-CREATE OR REPLACE FUNCTION pgis_geometry_clusterwithin_finalfn(pgis_abs)
+CREATE OR REPLACE FUNCTION pgis_geometry_clusterwithin_finalfn(internal)
 	RETURNS geometry[]
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
 
 -- Availability: 1.4.0
-CREATE OR REPLACE FUNCTION pgis_geometry_makeline_finalfn(pgis_abs)
+CREATE OR REPLACE FUNCTION pgis_geometry_makeline_finalfn(internal)
 	RETURNS geometry
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'c' _PARALLEL;
@@ -3926,7 +3904,7 @@
 -- Changed: 2.4.0 marked parallel safe
 CREATE AGGREGATE ST_Accum (geometry) (
 	sfunc = pgis_geometry_accum_transfn,
-	stype = pgis_abs,
+	stype = internal,
 #if POSTGIS_PGSQL_VERSION >= 96
 	parallel = safe,
 #endif
@@ -3945,7 +3923,7 @@
 -- parallel handling dealt with in postgis_drop_after.sql
 CREATE AGGREGATE ST_Union (geometry) (
 	sfunc = pgis_geometry_accum_transfn,
-	stype = pgis_abs,
+	stype = internal,
 #if POSTGIS_PGSQL_VERSION >= 96
 	parallel = safe,
 #endif
@@ -3956,7 +3934,7 @@
 -- Changed: 2.4.0: marked parallel safe
 CREATE AGGREGATE ST_Collect (geometry) (
 	SFUNC = pgis_geometry_accum_transfn,
-	STYPE = pgis_abs,
+	STYPE = internal,
 #if POSTGIS_PGSQL_VERSION >= 96
 	parallel = safe,
 #endif
@@ -3967,7 +3945,7 @@
 -- Changed: 2.4.0: marked parallel safe
 CREATE AGGREGATE ST_ClusterIntersecting (geometry) (
 	SFUNC = pgis_geometry_accum_transfn,
-	STYPE = pgis_abs,
+	STYPE = internal,
 #if POSTGIS_PGSQL_VERSION >= 96
 	parallel = safe,
 #endif
@@ -3978,7 +3956,7 @@
 -- Changed: 2.4.0 marked parallel safe
 CREATE AGGREGATE ST_ClusterWithin (geometry, float8) (
 	SFUNC = pgis_geometry_accum_transfn,
-	STYPE = pgis_abs,
+	STYPE = internal,
 #if POSTGIS_PGSQL_VERSION >= 96
 	parallel = safe,
 #endif
@@ -3989,7 +3967,7 @@
 -- Changed: 2.4.0 marked parallel safe
 CREATE AGGREGATE ST_Polygonize (geometry) (
 	SFUNC = pgis_geometry_accum_transfn,
-	STYPE = pgis_abs,
+	STYPE = internal,
 #if POSTGIS_PGSQL_VERSION >= 96
 	parallel = safe,
 #endif
@@ -4000,7 +3978,7 @@
 -- Changed: 2.4.0 marked parallel safe
 CREATE AGGREGATE ST_MakeLine (geometry) (
 	SFUNC = pgis_geometry_accum_transfn,
-	STYPE = pgis_abs,
+	STYPE = internal,
 #if POSTGIS_PGSQL_VERSION >= 96
 	parallel = safe,
 #endif



More information about the postgis-tickets mailing list