J. Greg Davidson wrote:
> I have a user defined type implemented in C and SPI which has been
> crashing a lot. I found a small enough case to trace the whole thing
> with gdb and found that while connected to SPI I was doing a get_value
> on a type T implemented in C and SPI. SPI_getvalue led to a call to T's
> output routine which called SPI_connect which failed because the
> previous SPI connection was still in force. The whole transaction was
> aborted, so without a long gdb session I wouldn't have caught it.
> Ironically the call to SPI_getvalue was in my debugging code!
The question that jumps at me is why are you using SPI inside a type's
output function? You should really avoid doing that.
If you absolutely need to do it, enclosing the function in SPI_push/pop
seems to me the least bad answer.