"Tim Keitt" <tkeitt@keittlab.org> writes:
> [questions]
Switching memory contexts, in itself, only switches which context a bare
palloc() will allocate from (as opposed to MemoryContextAlloc). It
cannot have some magic impact on the validity of existing pointers.
> One last question: if I call SPI_finish, on the first call, do I need
> to switch contexts in the per-call section? (I saw some example code
> that suggested one needs to switch contexts back to
> multi_call_memory_ctx after SPI_finish.)
I believe SPI_finish will switch back to the context that was current
when SPI_connect was called.
regards, tom lane