Skip to content

Commit 7758ae3

Browse files
committed
Revert "Update database_postgresql.c"
This reverts commit 13367c1.
1 parent 140d7f9 commit 7758ae3

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/postgresql/database_postgresql.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,18 @@ static int map_spi_result (int rc) {
244244
}
245245
}
246246

247-
static void clear_fetch_batch (pg_stmt_t *stmt) {
247+
static void clear_fetch_batch(pg_stmt_t *stmt) {
248248
if (!stmt) return;
249-
if (stmt->row_mcxt) MemoryContextReset(stmt->row_mcxt);
250-
249+
if (stmt->last_tuptable) {
250+
SPI_freetuptable(stmt->last_tuptable);
251+
stmt->last_tuptable = NULL;
252+
}
251253
stmt->current_tuple = NULL;
252254
stmt->current_tupdesc = NULL;
253-
stmt->last_tuptable = NULL;
255+
if (stmt->row_mcxt) MemoryContextReset(stmt->row_mcxt);
254256
}
255257

256-
static void close_portal (pg_stmt_t *stmt) {
258+
static void close_portal(pg_stmt_t *stmt) {
257259
if (!stmt) return;
258260
if (stmt->portal) {
259261
SPI_cursor_close(stmt->portal);

0 commit comments

Comments
 (0)