[geos-devel] fastunion aggregate

strk strk at keybit.net
Tue Oct 28 06:05:33 EST 2003


Having problems with memory instability I changed
unite_sfunc to always allocate memory for the sate array
in higher memory context. Since I do not know about initcond
lifetime interface is changed to having NULl state array as
initial condition and ! strict state and final functions:

--8<------------------------------------------------------------------

DROP AGGREGATE fastunion(geometry);
DROP FUNCTION unite_sfunc(geometry[], geometry);
DROP FUNCTION unite_finalfunc(geometry[]);

CREATE FUNCTION unite_sfunc (geometry[],geometry)
        RETURNS geometry[]
        AS '/usr/src/postgis/postgis/libpostgis.so.0.8'
        LANGUAGE 'C'; -- WITH (isstrict);

CREATE FUNCTION unite_finalfunc (geometry[])
        RETURNS geometry
        AS '/usr/src/postgis/postgis/libpostgis.so.0.8'
        LANGUAGE 'C'; --  WITH (isstrict);

CREATE AGGREGATE fastunion (
        -- initcond = '{}', -- needed for basetype != style && sfunc isstrict
        sfunc = unite_sfunc,
        basetype = geometry,
        stype = geometry[],
        finalfunc = unite_finalfunc
);

--8<------------------------------------------------------------------

Please report any segfault...

PS: remember to cvs update 

--strk;



More information about the geos-devel mailing list