Ian Haywood <ihaywood@iinet.net.au> writes:
> It seems as soon as execution leaves the main function access to SPI is lost. Is this correct or a bug?
What this probably means is that plpython is failing to use
SPI_push/SPI_pop properly --- these should be called around
any operation that might invoke an independent SPI-using function:
http://www.postgresql.org/docs/8.3/static/spi-spi-push.html
I'm not enough of a plpython user to be excited about trying to fix it,
but if you are then please send a patch.
regards, tom lane