aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/portalcmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-12-01 17:06:27 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-12-01 17:06:27 +0000
commitd044ac30a4bf969034d3ff3678dd6326511b9de9 (patch)
tree0f2b73cbdac057a234d60fac416649c8d65d0a70 /src/backend/commands/portalcmds.c
parentc0118c11a82b989d53bb66f113f10a666256e5da (diff)
downloadpostgresql-d044ac30a4bf969034d3ff3678dd6326511b9de9.tar.gz
postgresql-d044ac30a4bf969034d3ff3678dd6326511b9de9.zip
Ensure that the contents of a holdable cursor don't depend on out-of-line
toasted values, since those could get dropped once the cursor's transaction is over. Per bug #4553 from Andrew Gierth. Back-patch as far as 8.1. The bug actually exists back to 7.4 when holdable cursors were introduced, but this patch won't work before 8.1 without significant adjustments. Given the lack of field complaints, it doesn't seem worth the work (and risk of introducing new bugs) to try to make a patch for the older branches.
Diffstat (limited to 'src/backend/commands/portalcmds.c')
-rw-r--r--src/backend/commands/portalcmds.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c
index 5a93aec6890..7bf012a47c7 100644
--- a/src/backend/commands/portalcmds.c
+++ b/src/backend/commands/portalcmds.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.69.2.1 2008/04/02 18:32:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.69.2.2 2008/12/01 17:06:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,6 +26,7 @@
#include "access/xact.h"
#include "commands/portalcmds.h"
#include "executor/executor.h"
+#include "executor/tstoreReceiver.h"
#include "tcop/pquery.h"
#include "utils/memutils.h"
@@ -350,8 +351,12 @@ PersistHoldablePortal(Portal portal)
*/
ExecutorRewind(queryDesc);
- /* Change the destination to output to the tuplestore */
+ /*
+ * Change the destination to output to the tuplestore. Note we
+ * tell the tuplestore receiver to detoast all data passed through it.
+ */
queryDesc->dest = CreateDestReceiver(DestTuplestore, portal);
+ SetTuplestoreDestReceiverDeToast(queryDesc->dest, true);
/* Fetch the result set into the tuplestore */
ExecutorRun(queryDesc, ForwardScanDirection, 0L);