[postgis-users] Union as an aggregate
David Blasby
dblasby at refractions.net
Mon Sep 29 17:28:52 PDT 2003
strk wrote:
> Dave, I made no special 'unite' code, just sql create command:
> CREATE AGGREGATE unite (
> sfunc = GeomUnion,
> basetype = geometry,
> stype = geometry
> );
Hum - this shouldnt do anything.
The aggregate should have "null" as its initial value.
GeomUnion(null,<geometry>) --> null.
So, you'll end up with null *very* quickly because
GeomUnion(null,<geometry>) returns null without any actual execution.
Are you running this on a big table? At worst I'd expect this to use up
memory the same size all the geometries in the table.
I'll look more at this tomorrow.
dave
ps. just as a test, try redefining your unite to:
CREATE AGGREGATE unite (
sfunc = GeomUnion,
basetype = geometry,
stype = geometry,
initial_condition = '<wkt>'
);
Where <wkt> is the well known text of one of the geometries in your
table. This will force the initial function to be:
GeomUnion(<wkt>,<geometry>) --> <geometry>
And things might work. If this does work, then the problem is that the
postgresql aggregate function code isnt paying attention to the
"isstrict" tags on the base ("geomUnion") function.
More information about the postgis-users
mailing list