Ian Campbell <ianrc72@gmail.com> writes:
> OK, so SPI is only suitable for single-call functions, right?
It's usable by strictly nested functions, but a multi-call SRF is more
like a coroutine.
> If another
> function in the query attempted to use SPI, I assume there would be a
> deadlock?
No, the second arrival would get a SPI_ERROR_CONNECT failure from
SPI_connect when there's already an open connection. For the nested-
calls case you can prevent that with SPI_push/SPI_pop around a call that
might wish to use SPI, but that fix doesn't work in a coroutine situation.
regards, tom lane