Re: [HACKERS] MemoryContextSwitchTo() confusion

2008-03-20 Thread korry
Everything seems to work fine, except on the final call it has no more data to return so cleans up all it's internal data structures and returns with SRF_RETURN_DONE(funcctx). If you are doing your development work on a Linux host, you may find it useful to run the postmaster through valgrind

Re: [HACKERS] MemoryContextSwitchTo() confusion

2008-03-20 Thread NikhilS
src/backend/utils/mmgr/README contains more information about the same too. Regards, Nikhils On Thu, Mar 20, 2008 at 2:41 PM, Pavan Deolasee <[EMAIL PROTECTED]> wrote: > On Thu, Mar 20, 2008 at 12:27 AM, Dan Searle <[EMAIL PROTECTED]> wrote: > > > > > I had to fiddle about with switching memory

Re: [HACKERS] MemoryContextSwitchTo() confusion

2008-03-20 Thread Pavan Deolasee
On Thu, Mar 20, 2008 at 12:27 AM, Dan Searle <[EMAIL PROTECTED]> wrote: > > I had to fiddle about with switching memory contexts rather a lot to > make it work this far, but I'm only guessing as to when it's appropriate > to call MemoryContextSwitchTo(), and to which context to switch to Here

[HACKERS] MemoryContextSwitchTo() confusion

2008-03-20 Thread Dan Searle
Hi, I've written a custom C-language function that takes a SQL select statement as it's input parameter, runs the query using the SPI interface, iterates over all the results of the select using a cursor and collates the data using a tsearch type binary tree, then walks the tree to create a f