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!
This behavior was unexpected and very hard to track down. If SPI_getvalue is supposed to be this fragile, it would be good to document that. I'm now experimenting with creating a wrapper function which surrounds SPI_getvalue with SPI_push and SPI_pop. On a related issue - it would be very handy to have something which can be called or tested from a type extension module to find out if an SPI connection exists. Such a feature would be especially useful for asserts. As far as I can tell from reading the server code, any such state is hidden in static variables. Finally, I tried to submit this bug at http://wwwmaster.postgresql.org/system/handleform.php as requested by the documentation at PostgreSQL.org, but it rejected my attempt saying "The email address you entered does not appear to be valid." The email address in question is "[EMAIL PROTECTED]" which is indeed valid and is the one I use to receive postgresql mailing lists. Thanks for reading this feedback and keep up the good work, _Greg ---------------------------(end of broadcast)--------------------------- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate