]> granicus.if.org Git - postgis/commitdiff
datumCopy has to happen in agg context or else
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 7 Oct 2019 01:29:38 +0000 (01:29 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 7 Oct 2019 01:29:38 +0000 (01:29 +0000)
objects larger than datum size will be lost.
Shows up in 32 bit because float8 doesn't fit
on a datum.
Closes #4522

git-svn-id: http://svn.osgeo.org/postgis/trunk@17863 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_accum.c

index 950274375c1798d01f70866fe92e9e1a775f617d..eb96fe4185e7d9443232ded3302bf27318a1815c 100644 (file)
@@ -97,7 +97,9 @@ pgis_geometry_accum_transfn(PG_FUNCTION_ARGS)
                {
                        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