[postgis-devel] What's the difference between geom_accum andbuilt in postgresql array_append

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Wed Aug 20 07:01:18 PDT 2008


Obe, Regina wrote:

> Mark,
> 
> Actually in building the cascade union approach, I realized a situation
> where I actually needed this geom_accum vs. the array_append.  I got
> some bizarre error which I'll need to investigate further whether it was
> an error in my logic or something special about the geom_accum.   
> 
> The speeds were always the same, but I suspect the issue may come when
> you have a null array that the geom_accum null array is naturally typed
> as a geometry array and the array_append since its a generic array
> operator becomes questionable what it is if it has nulls or is null.

Interesting. Feel free to post a test case, and hopefully with more eyes 
it should be possible to see what is happening.

> At anyrate - that doesn't mean geom_accum isn't redundant and couldn't
> be better served by just wrapping array_append in a sql function that
> casts it to a geometry array.
> 
> I also haven't looked to see if geom_accum is used anywhere within the
> postgis codebase itself apart from its use in the postgresql functions. 
> 
> It sure would have saved us that issue with the 1.3.2 release if we had
> just used array_append since I realized the other solution of fixing a
> bad 1.3.2 install was swapping out the use of geom_accum with
> array_append. 
> 
> I presume also if structural or logical improvements to array handling
> happen in future postgresql codebase, we would reap the benefits without
> having to do anything special.

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 :(


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list