This is an automated email from the ASF dual-hosted git repository.

ztao1987 pushed a commit to branch taoz
in repository https://gitbox.apache.org/repos/asf/hawq.git

commit b116d03337beb615df705b8a580ac44d4e0b9666
Author: ztao1987 <zhenglin.ta...@gmail.com>
AuthorDate: Fri Aug 27 14:45:10 2021 +0800

    HAWQ-1803. Fix sub-transcation rollback in SP
---
 src/backend/executor/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index b0db875..03cdda7 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -393,7 +393,7 @@ AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid)
         * If we are aborting a subtransaction and there is an open SPI context
         * surrounding the subxact, clean up to prevent memory leakage.
         */
-       if (_SPI_current && !isCommit)
+       if (_SPI_current && !isCommit && _SPI_current->connectSubid >= mySubid)
        {
                /* free Executor memory the same as _SPI_end_call would do */
                MemoryContextResetAndDeleteChildren(_SPI_current->execCxt);

Reply via email to