| From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
|---|---|
| To: | "J(dot) Greg Davidson" <jgd(at)well(dot)com> |
| Cc: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: SPI_getvalue calls output function w/o pushing existing SPI connection + 2 extra issues |
| Date: | 2006-12-12 12:32:33 |
| Message-ID: | 20061212123233.GA12721@alvh.no-ip.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Danish Siddiqui | 2006-12-12 13:53:37 | postgresql installation on centOS not working |
| Previous Message | Heikki Linnakangas | 2006-12-12 12:02:23 | Re: 8.2 pl/pgsql crash bug (WAS: [pgadmin-support] Error craches |