diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/tablefunc/tablefunc.c | 20 | ||||
-rw-r--r-- | contrib/xml2/xpath.c | 4 |
2 files changed, 0 insertions, 24 deletions
diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c index 9c9d0aa7a29..019c2175bb2 100644 --- a/contrib/tablefunc/tablefunc.c +++ b/contrib/tablefunc/tablefunc.c @@ -765,7 +765,6 @@ load_categories_hash(char *cats_sql, MemoryContext per_query_ctx) HASHCTL ctl; int ret; int proc; - MemoryContext SPIcontext; /* initialize the category hash table */ MemSet(&ctl, 0, sizeof(ctl)); @@ -956,10 +955,7 @@ get_crosstab_tuplestore(char *sql, /* rowid changed, flush the previous output row */ tuple = BuildTupleFromCStrings(attinmeta, values); - /* switch to appropriate context while storing the tuple */ - SPIcontext = MemoryContextSwitchTo(per_query_ctx); tuplestore_puttuple(tupstore, tuple); - MemoryContextSwitchTo(SPIcontext); for (j = 0; j < result_ncols; j++) xpfree(values[j]); @@ -992,10 +988,7 @@ get_crosstab_tuplestore(char *sql, /* flush the last output row */ tuple = BuildTupleFromCStrings(attinmeta, values); - /* switch to appropriate context while storing the tuple */ - SPIcontext = MemoryContextSwitchTo(per_query_ctx); tuplestore_puttuple(tupstore, tuple); - MemoryContextSwitchTo(SPIcontext); } if (SPI_finish() != SPI_OK_FINISH) @@ -1277,7 +1270,6 @@ build_tuplestore_recursively(char *key_fld, Tuplestorestate *tupstore) { TupleDesc tupdesc = attinmeta->tupdesc; - MemoryContext oldcontext; int ret; int proc; int serial_column; @@ -1355,15 +1347,9 @@ build_tuplestore_recursively(char *key_fld, /* construct the tuple */ tuple = BuildTupleFromCStrings(attinmeta, values); - /* switch to long lived context while storing the tuple */ - oldcontext = MemoryContextSwitchTo(per_query_ctx); - /* now store it */ tuplestore_puttuple(tupstore, tuple); - /* now reset the context */ - MemoryContextSwitchTo(oldcontext); - /* increment level */ level++; } @@ -1449,15 +1435,9 @@ build_tuplestore_recursively(char *key_fld, xpfree(current_key); xpfree(current_key_parent); - /* switch to long lived context while storing the tuple */ - oldcontext = MemoryContextSwitchTo(per_query_ctx); - /* store the tuple for later use */ tuplestore_puttuple(tupstore, tuple); - /* now reset the context */ - MemoryContextSwitchTo(oldcontext); - heap_freetuple(tuple); /* recurse using current_key_parent as the new start_with */ diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index 828545c763c..b4452cfd840 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -834,9 +834,7 @@ xpath_table(PG_FUNCTION_ARGS) { /* not well-formed, so output all-NULL tuple */ ret_tuple = BuildTupleFromCStrings(attinmeta, values); - oldcontext = MemoryContextSwitchTo(per_query_ctx); tuplestore_puttuple(tupstore, ret_tuple); - MemoryContextSwitchTo(oldcontext); heap_freetuple(ret_tuple); } else @@ -910,9 +908,7 @@ xpath_table(PG_FUNCTION_ARGS) if (had_values) { ret_tuple = BuildTupleFromCStrings(attinmeta, values); - oldcontext = MemoryContextSwitchTo(per_query_ctx); tuplestore_puttuple(tupstore, ret_tuple); - MemoryContextSwitchTo(oldcontext); heap_freetuple(ret_tuple); } |