aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2009-12-29 17:40:59 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2009-12-29 17:40:59 +0000
commit84d723b6cefcf25b8c800f8aa6cf3c9538a546b4 (patch)
treefa91ab7b2bc60f3d602a330bc68b78ae8beab69b /src/backend/executor/functions.c
parent50ef9f7b0612c755097bbddd7f2985237030c31a (diff)
downloadpostgresql-84d723b6cefcf25b8c800f8aa6cf3c9538a546b4.tar.gz
postgresql-84d723b6cefcf25b8c800f8aa6cf3c9538a546b4.zip
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 'src/backend/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 8ac98236ec3..3b269668d26 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.138 2009/12/15 04:57:47 rhaas Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.139 2009/12/29 17:40:59 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1405,15 +1405,12 @@ static void
sqlfunction_receive(TupleTableSlot *slot, DestReceiver *self)
{
DR_sqlfunction *myState = (DR_sqlfunction *) self;
- MemoryContext oldcxt;
/* Filter tuple as needed */
slot = ExecFilterJunk(myState->filter, slot);
/* Store the filtered tuple into the tuplestore */
- oldcxt = MemoryContextSwitchTo(myState->cxt);
tuplestore_puttupleslot(myState->tstore, slot);
- MemoryContextSwitchTo(oldcxt);
}
/*