diff options
author | Heikki Linnakangas | 2010-07-05 09:27:18 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2010-07-05 09:27:18 +0000 |
commit | eb81b6509f4c9109ecf8839d8c482cc597270687 (patch) | |
tree | bdf77cd59647f8e932ddaf8774f90cc2ab901b4d /src/include | |
parent | 2330d9c1475a70385b116fda6cc54ac2cc2939c4 (diff) |
The previous fix in CVS HEAD and 8.4 for handling the case where a cursor
being used in a PL/pgSQL FOR loop is closed was inadequate, as Tom Lane
pointed out. The bug affects FOR statement variants too, because you can
close an implicitly created cursor too by guessing the "<unnamed portal X>"
name created for it.
To fix that, "pin" the portal to prevent it from being dropped while it's
being used in a PL/pgSQL FOR loop. Backpatch all the way to 7.4 which is
the oldest supported version.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/utils/portal.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h index 75101a782bf..30214e68f3a 100644 --- a/src/include/utils/portal.h +++ b/src/include/utils/portal.h @@ -39,7 +39,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.82 2010/01/02 16:58:10 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.83 2010/07/05 09:27:17 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -133,6 +133,7 @@ typedef struct PortalData /* Status data */ PortalStatus status; /* see above */ + bool portalPinned; /* a pinned portal can't be dropped */ /* If not NULL, Executor is active; call ExecutorEnd eventually: */ QueryDesc *queryDesc; /* info needed for executor invocation */ @@ -199,6 +200,8 @@ extern void AtSubAbort_Portals(SubTransactionId mySubid, extern void AtSubCleanup_Portals(SubTransactionId mySubid); extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent); extern Portal CreateNewPortal(void); +extern void PinPortal(Portal portal); +extern void UnpinPortal(Portal portal); extern void PortalDrop(Portal portal, bool isTopCommit); extern Portal GetPortalByName(const char *name); extern void PortalDefineQuery(Portal portal, |