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

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: SPI_getvalue calls output function w/o pushing existing SPI connection + 2 extra issues
Дата
Msg-id 20061212123233.GA12721@alvh.no-ip.org
обсуждение исходный текст
Ответ на SPI_getvalue calls output function w/o pushing existing SPI connection + 2 extra issues  ("J. Greg Davidson" <jgd@well.com>)
Ответы Re: SPI_getvalue calls output function w/o pushing existing SPI connection + 2 extra issues  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
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.

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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: 8.2 pl/pgsql crash bug (WAS: [pgadmin-support] Error craches
Следующее
От: ""
Дата:
Сообщение: BUG #2824: Problem with installation by Remote Desktop