1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-09 02:08:45 +03:00

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.
This commit is contained in:
Tom Lane
2008-12-01 17:06:35 +00:00
parent eea4890c08
commit ad807ff65d
3 changed files with 155 additions and 14 deletions

View File

@@ -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);