summaryrefslogtreecommitdiff
path: root/src/backend/commands/portalcmds.c
diff options
context:
space:
mode:
authorTom Lane2008-12-01 17:06:21 +0000
committerTom Lane2008-12-01 17:06:21 +0000
commitec543db77b6b72f24d0a637c4a4a419cf8311d0b (patch)
tree7d031efb72122b39ed7fa5a73e63bafff8b1bfe6 /src/backend/commands/portalcmds.c
parent3191ab5dcc93f3e8a921f4b74bd4b40c30c0980b (diff)
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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c
index 45776277d88..9b74f1bdc1a 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.76 2008/11/30 20:51:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.77 2008/12/01 17:06:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -351,11 +351,15 @@ 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);
SetTuplestoreDestReceiverParams(queryDesc->dest,
portal->holdStore,
- portal->holdContext);
+ portal->holdContext,
+ true);
/* Fetch the result set into the tuplestore */
ExecutorRun(queryDesc, ForwardScanDirection, 0L);