OSDN Git Service

Previous fix for temporary file management broke returning a set from
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 29 Dec 2009 17:40:59 +0000 (17:40 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 29 Dec 2009 17:40:59 +0000 (17:40 +0000)
commit84d723b6cefcf25b8c800f8aa6cf3c9538a546b4
treefa91ab7b2bc60f3d602a330bc68b78ae8beab69b
parent50ef9f7b0612c755097bbddd7f2985237030c31a
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