Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2009-12-29 17:40:59 +0000
committerHeikki Linnakangas2009-12-29 17:40:59 +0000
commit84d723b6cefcf25b8c800f8aa6cf3c9538a546b4 (patch)
treefa91ab7b2bc60f3d602a330bc68b78ae8beab69b /contrib/xml2/xpath.c
parent50ef9f7b0612c755097bbddd7f2985237030c31a (diff)
Previous fix for temporary file management broke returning a set from
PL/pgSQL function within an exception handler. Make sure we use the right resource owner when we create the tuplestore to hold returned tuples. Simplify tuplestore API so that the caller doesn't need to be in the right memory context when calling tuplestore_put* functions. tuplestore.c automatically switches to the memory context used when the tuplestore was created. Tuplesort was already modified like this earlier. This patch also removes the now useless MemoryContextSwitch calls from callers. Report by Aleksei on pgsql-bugs on Dec 22 2009. Backpatch to 8.1, like the previous patch that broke this.
Diffstat (limited to 'contrib/xml2/xpath.c')
-rw-r--r--contrib/xml2/xpath.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c
index 203e53905be..a003dd00c82 100644
--- a/contrib/xml2/xpath.c
+++ b/contrib/xml2/xpath.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.23 2009/06/11 14:48:53 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.24 2009/12/29 17:40:59 heikki Exp $
*
* Parser interface for DOM-based parser (libxml) rather than
* stream-based SAX-type parser
@@ -821,9 +821,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
@@ -897,9 +895,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);
}