[postgis-tickets] r17863 - datumCopy has to happen in agg context or else

Paul Ramsey pramsey at cleverelephant.ca
Sun Oct 6 06:29:38 PDT 2019


Author: pramsey
Date: 2019-10-06 18:29:38 -0700 (Sun, 06 Oct 2019)
New Revision: 17863

Modified:
   trunk/postgis/lwgeom_accum.c
Log:
datumCopy has to happen in agg context or else
objects larger than datum size will be lost.
Shows up in 32 bit because float8 doesn't fit
on a datum.
Closes #4522


Modified: trunk/postgis/lwgeom_accum.c
===================================================================
--- trunk/postgis/lwgeom_accum.c	2019-10-07 01:13:37 UTC (rev 17862)
+++ trunk/postgis/lwgeom_accum.c	2019-10-07 01:29:38 UTC (rev 17863)
@@ -97,7 +97,9 @@
 		{
 			Datum argument = PG_GETARG_DATUM(i+2);
 			Oid dataOid = get_fn_expr_argtype(fcinfo->flinfo, i+2);
+			old = MemoryContextSwitchTo(aggcontext);
 			state->data[i] = datumCopy(argument, get_typbyval(dataOid), get_typlen(dataOid));
+			MemoryContextSwitchTo(old);
 		}
 	}
 	else



More information about the postgis-tickets mailing list