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:35 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-12-01 17:06:35 +0000
commitad807ff65d7b22e192dcbb79a0e8c75ff8a4990b (patch)
tree36534a1065fcd5cd9e9414d9b6730fc184380e5d /src/backend/commands/portalcmds.c
parenteea4890c08200ef97e565ea7957ea58cab9a5f33 (diff)
downloadpostgresql-ad807ff65d7b22e192dcbb79a0e8c75ff8a4990b.tar.gz
postgresql-ad807ff65d7b22e192dcbb79a0e8c75ff8a4990b.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 0fefb66174f..4c23e86bafb 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.57.2.1 2007/02/06 22:49:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.57.2.2 2008/12/01 17:06:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,6 +26,7 @@
#include "access/xact.h"
#include "commands/portalcmds.h"
#include "executor/executor.h"
+#include "executor/tstoreReceiver.h"
#include "optimizer/planner.h"
#include "rewrite/rewriteHandler.h"
#include "tcop/pquery.h"
@@ -375,8 +376,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);