On Fri, Apr 20, 2018 at 10:00:38AM +0800, jian.long@i-soft.com.cn wrote:
> what about just free _SPI_stack in AtEOXact_SPI? if the transaction
> end was initiated by SPI , AtEOXact_SPI will do nothing. For example:
> @@ -283,6 +295,8 @@ AtEOXact_SPI(bool isCommit)
> errmsg("transaction left non-empty SPI stack"),
> errhint("Check for missing \"SPI_finish\" calls.")));
>
> + if (_SPI_stack)
> + pfree(_SPI_stack);
Sure, but that is rather inconsistent with the handling which exists
using TopTransactionContext where the API stack is deleted at the same
time as the transaction context, which causes this approach to be
inconsistent for atomic and non-atomic calls of SPI_connect_ext. Let's
see what is Peter's take here first.
--
Michael