Re: SPI_finish and RegisterExprContextCallback - Mailing list pgsql-hackers

From Thomas Hallgren
Subject Re: SPI_finish and RegisterExprContextCallback
Date
Msg-id thhal-0O7fxAmWlxic3a2eD4mr6vuqtSwG+mi@mailblocks.com
Whole thread Raw
In response to Re: SPI_finish and RegisterExprContextCallback  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom,

>You're right, you can't just return from that inner function while
>leaving its SPI connection open.
>
>It might be interesting to redesign SPI around the notion of independent
>"connection objects" rather than necessarily having a stack of 'em.
>  
>
I made the same reflection looking at the SPI code. It would be nice if 
something corresponding to _SPI_current could be passed around.

>I think that could be made to work ... but not while preserving the
>existing SPI API.
>
I'm not so sure you'd have to. A public API that can disable stack 
handling and instead use something similar to MemoryContextSwitchTo but 
for an _SPI_current like structure would perhaps be sufficient?

>  I'm hesitant to break a ton of user-written code for
>a feature that only one person has needed :-(
>  
>
It is a fairly serious design flaw IMHO. I discovered it and so far no 
one else has complained. That's true for all flaws at first.

Regards,
Thomas Hallgren




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: SPI_finish and RegisterExprContextCallback
Next
From: Tom Lane
Date:
Subject: Re: Data loss, vacuum, transaction wrap-around