SPI_getvalue calls output function w/o pushing existing SPI connection + 2 extra issues

Поиск
Список
Период
Сортировка
От J. Greg Davidson
Тема SPI_getvalue calls output function w/o pushing existing SPI connection + 2 extra issues
Дата
Msg-id 1165901615.7709.92.camel@shevek.ifsrad.org
обсуждение исходный текст
Ответы Re: SPI_getvalue calls output function w/o pushing existing SPI connection + 2 extra issues  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-bugs
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 "jgd@well.com" 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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2823: API largeobject calls
Следующее
От: Pavel Golub
Дата:
Сообщение: User-defined type name begins with the underscore character (_) can be created