Re: [GENERAL] Recovering from an exception

2013-01-01 Thread Marko Tiikkaja
On Wed, 02 Jan 2013 01:16:11 +0100, I wrote: I'm puzzled as to why AtEOSubXact_SPI() needs to unconditionally clear the surround SPI context, or why it assumes it's a good idea. I managed to fix this by creating my own SPI context outside the subtransaction for AtEOSubXact_SPI() to destroy,

Re: [GENERAL] Recovering from an exception

2013-01-01 Thread Marko Tiikkaja
Hi, On Tue, 01 Jan 2013 15:56:50 +0100, I wrote: It looks like fcinfo (amongst other things) is allocated in a child of the SPI context. My speculation is that the SPI context gets reset by AtEOSubXact_SPI(), thus resetting the memory fcinfo points to, leading to SIGSEGV. Indeed, that looks t

[GENERAL] Recovering from an exception

2013-01-01 Thread Marko Tiikkaja
Hi, I'm trying to recover from an exception in an fmgr hook. It seems to work relatively well most of the time, but in some cases the backend segfaults. Attached is a self-contained test case demonstrating the problem. The problem I'm hitting can be reproduced with: create function f4() r