Previous fix for temporary file management broke returning a set from
authorHeikki Linnakangas <heikki@enterprisedb.com>
Tue, 29 Dec 2009 17:40:59 +0000 (17:40 +0000)
committerHeikki Linnakangas <heikki@enterprisedb.com>
Tue, 29 Dec 2009 17:40:59 +0000 (17:40 +0000)
commitca4556870d566cf0ddccdaa4b95e267e5dc623d1
tree77a77841bbbc7960ffae70824502943d68296761
parentb407a3497d0a282b275762b8192ec976ac7880c7
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.
14 files changed:
contrib/dblink/dblink.c
contrib/pg_stat_statements/pg_stat_statements.c
contrib/tablefunc/tablefunc.c
contrib/xml2/xpath.c
src/backend/commands/prepare.c
src/backend/executor/execQual.c
src/backend/executor/functions.c
src/backend/executor/nodeWindowAgg.c
src/backend/executor/tstoreReceiver.c
src/backend/utils/mmgr/portalmem.c
src/backend/utils/sort/tuplestore.c
src/pl/plperl/plperl.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/plpgsql.h