On Mon, Aug 03, 2009 at 10:20:36AM -0400, Tom Lane wrote: > Martijn van Oosterhout <kleptog@xxxxxxxxx> writes: > > What you need to do is copy the Datum you wish to return into the upper > > memory context. I'm not seeing a helpful SPI utility function or > > obvious example here you help you, but I'm sure it's something with > > MemoryContextSwitchTo() and datumCopy(). > > SPI_palloc is what to use to allocate the result in the right place. Ofcourse, and then a memcpy(). I was distracted by the fact there is an SPI_copy/returntuple(), but no SPI_returndatum(). It might actually be helpful to include in the documentation an example of returning from a function a result from SPI, since it's not entirely obvious. Have a nice day, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boarding. Thank you for flying nlogn airlines.
Attachment:
signature.asc
Description: Digital signature