[postgis-devel] - early return from force_collection...DONT!
dblasby at openplans.org
dblasby at openplans.org
Wed Mar 2 10:12:15 PST 2005
strk,
I saw the comment "- early return from force_collection" in your message
and checked the function.
*NEVER* just return a pointer argument given to a function! Always copy
and return.
Your implementation may fail if the incomming geometry isnt actually
toasted (detoasting makes a "copy" of the data for you). If its not
toasted (ie. < 2kb) then you are relying on postgresql's memory manager
to "do the right thing" and not free the arguments until *after* its
serialized the result (since they're the same block of memory). Thats
a pretty big assumption!!
The function may also be called by other people's functions (using the
direct function call method) or inside a chain of functions by
postgresql, or in a chain of calls involving non-cachable functions.
All of these have assumptions about whats being returned and what they
can do with it.
dave
----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/
More information about the postgis-devel
mailing list