diff options
Diffstat (limited to 'src/backend/executor/spi.c')
-rw-r--r-- | src/backend/executor/spi.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index c0231ce317a..7c65c66814f 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -3,7 +3,7 @@ * spi.c * Server Programming Interface * - * $Id: spi.c,v 1.43 1999/12/10 03:55:51 momjian Exp $ + * $Id: spi.c,v 1.44 1999/12/16 22:19:44 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -543,6 +543,26 @@ SPI_pfree(void *pointer) return; } +void +SPI_freetuple(HeapTuple tuple) +{ + MemoryContext oldcxt = NULL; + + if (_SPI_curid + 1 == _SPI_connected) /* connected */ + { + if (_SPI_current != &(_SPI_stack[_SPI_curid + 1])) + elog(FATAL, "SPI: stack corrupted"); + oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt); + } + + heap_freetuple(tuple); + + if (oldcxt) + MemoryContextSwitchTo(oldcxt); + + return; +} + /* =================== private functions =================== */ /* |