Skip to content

Commit 13367c1

Browse files
committed
Update database_postgresql.c
1 parent ffd587a commit 13367c1

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/postgresql/database_postgresql.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,16 @@ 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->last_tuptable) {
250-
SPI_freetuptable(stmt->last_tuptable);
251-
stmt->last_tuptable = NULL;
252-
}
249+
if (stmt->row_mcxt) MemoryContextReset(stmt->row_mcxt);
250+
253251
stmt->current_tuple = NULL;
254252
stmt->current_tupdesc = NULL;
255-
if (stmt->row_mcxt) MemoryContextReset(stmt->row_mcxt);
253+
stmt->last_tuptable = NULL;
256254
}
257255

258-
static void close_portal(pg_stmt_t *stmt) {
256+
static void close_portal (pg_stmt_t *stmt) {
259257
if (!stmt) return;
260258
if (stmt->portal) {
261259
SPI_cursor_close(stmt->portal);

0 commit comments

Comments
 (0)