[postgis-devel] What's the difference between geom_accum andbuiltin postgresql array_append
Obe, Regina
robe.dnd at cityofboston.gov
Sat Aug 30 10:28:22 PDT 2008
Getting back to this topic. Recall I said there was a situation where LWGEOM_accum worked where array_append didn't. I can't replicate it so I suspect it was an earlier error in my indexing efforts that caused this issue. I am also not seeing this LWGEOM_accum function used directly in any of the postgis code base.
So here is my half-assed suggestion since no one seems to know why we should maintain the LWGEOM_accum function instead of just using built-in PostgreSQL array_append function.
Simply get rid of LWGEOM_accum from our code base (or deprecate it) -- change
/**CREATE OR REPLACE FUNCTION st_geom_accum(geometry[], geometry)
RETURNS geometry[] AS
'$libdir/liblwgeom.dll', 'LWGEOM_accum'
LANGUAGE 'c' IMMUTABLE;
***/
To:
CREATE OR REPLACE FUNCTION st_geom_accum(geometry[], geometry)
RETURNS geometry[] AS
$$ SELECT array_append($1,$2); $$
LANGUAGE 'sql' IMMUTABLE;
And that's it. In tests I've done doing above, I don't see a definitive speed difference and all aggs we have seem to have this function for collecting geometries.
I would have suggested replacing our use in aggregates directly with array_append, but thought it would be better to keep this buffer for 3 reasons
1) We don't have a CREATE OR REPLACE AGGREGATE which makes changing aggs without a drop reload tricky. Changing this function will auto-magically correct the aggs. Granted 1.4 people should be doing a full reload anyway.
2) Don't know if anyone is relying on the st_geom_accum function so we probably should keep it around anyway.
3) In case we are wrong. It won't be a major undertaking to correct the mistake.
Any thoughts, concerns?
Thanks,
Regina
-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net on behalf of Mark Cave-Ayland
Sent: Wed 8/20/2008 11:16 AM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] What's the difference between geom_accum andbuiltin postgresql array_append
Paul Ramsey wrote:
>> Yeah, that's one good argument. The reason the 8.3 changes hit us so hard
>> were because we were accessing the varlena structures directly rather than
>> using the relevant macros :(
>
> Speaking of which, I see those damned macros sprinkled hither and yon,
> but I have no idea where they are documented. PgSQL source code only?
> It would be nice to know what they do.
>
> P.
Yeah, it's generally a case of "read the source" :( While it can be
tricky to find the relevant header file, the macros are generally well
documented when you do find them.
ATB,
Mark.
--
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20080830/646c7132/attachment.html>
More information about the postgis-devel
mailing list