1 /*-------------------------------------------------------------------------
4 * POSTGRES portal definitions.
7 * Copyright (c) 1994, Regents of the University of California
9 * $Id: portal.h,v 1.4 1997/08/19 21:40:48 momjian Exp $
11 *-------------------------------------------------------------------------
15 * A portal is an abstraction which represents the execution state of
16 * a running query (or a fixed sequence of queries). The "blank portal" is
17 * a portal with an InvalidName. This blank portal is in existance except
18 * between calls to BlankPortalAssignName and GetPortalByName(NULL).
21 * now that PQ calls can be made from within a backend, a portal
22 * may also be used to keep track of the tuples resulting
23 * from the execution of a query. In this case, entryIndex
28 #include <executor/execdesc.h>
29 #include <lib/fstack.h>
30 #include <nodes/memnodes.h>
31 #include <utils/memutils.h>
33 typedef struct PortalBlockData {
35 FixedItemData itemData;
38 typedef PortalBlockData *PortalBlock;
40 typedef struct PortalD PortalD;
41 typedef PortalD *Portal;
44 char *name; /* XXX PortalName */
45 struct PortalVariableMemory variable;
46 struct PortalHeapMemory heap;
50 void (*cleanup)(Portal);
55 * True iff portal is valid.
57 #define PortalIsValid(p) PointerIsValid(p)
60 * Special portals (well, their names anyway)
62 #define VACPNAME "<vacuum>"
64 extern bool PortalNameIsSpecial(char *pname);
65 extern void AtEOXact_portals(void);
66 extern void EnablePortalManager(bool on);
67 extern Portal GetPortalByName(char *name);
68 extern Portal BlankPortalAssignName(char *name);
69 extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
70 TupleDesc attinfo, EState *state,
71 void (*cleanup)(Portal portal));
72 extern QueryDesc *PortalGetQueryDesc(Portal portal);
73 extern EState *PortalGetState(Portal portal);
74 extern Portal CreatePortal(char *name);
75 extern void PortalDestroy(Portal *portalP);
76 extern void StartPortalAllocMode(AllocMode mode, Size limit);
77 extern void EndPortalAllocMode(void);
78 extern PortalVariableMemory PortalGetVariableMemory(Portal portal);
79 extern PortalHeapMemory PortalGetHeapMemory(Portal portal);
81 /* estimate of the maximum number of open portals a user would have,
82 * used in initially sizing the PortalHashTable in EnablePortalManager()
84 #define PORTALS_PER_USER 10