diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/nodes/parsenodes.h | 6 | ||||
-rw-r--r-- | src/include/storage/buffile.h | 4 | ||||
-rw-r--r-- | src/include/storage/fd.h | 4 | ||||
-rw-r--r-- | src/include/tcop/dest.h | 5 | ||||
-rw-r--r-- | src/include/utils/portal.h | 39 | ||||
-rw-r--r-- | src/include/utils/tuplestore.h | 5 |
6 files changed, 48 insertions, 15 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 49887f450cb..3d4b235e562 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parsenodes.h,v 1.235 2003/03/20 18:52:48 momjian Exp $ + * $Id: parsenodes.h,v 1.236 2003/03/27 16:51:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1210,7 +1210,9 @@ typedef struct CommentStmt */ #define CURSOR_OPT_BINARY 0x0001 #define CURSOR_OPT_SCROLL 0x0002 -#define CURSOR_OPT_INSENSITIVE 0x0004 +#define CURSOR_OPT_NO_SCROLL 0x0004 +#define CURSOR_OPT_INSENSITIVE 0x0008 +#define CURSOR_OPT_HOLD 0x0010 typedef struct DeclareCursorStmt { diff --git a/src/include/storage/buffile.h b/src/include/storage/buffile.h index 902483a1fb3..c456b74d0f6 100644 --- a/src/include/storage/buffile.h +++ b/src/include/storage/buffile.h @@ -18,7 +18,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: buffile.h,v 1.12 2002/06/20 20:29:52 momjian Exp $ + * $Id: buffile.h,v 1.13 2003/03/27 16:51:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -34,7 +34,7 @@ typedef struct BufFile BufFile; * prototypes for functions in buffile.c */ -extern BufFile *BufFileCreateTemp(void); +extern BufFile *BufFileCreateTemp(bool interTxn); extern void BufFileClose(BufFile *file); extern size_t BufFileRead(BufFile *file, void *ptr, size_t size); extern size_t BufFileWrite(BufFile *file, void *ptr, size_t size); diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index a13cec41ea6..261e6314e91 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: fd.h,v 1.36 2002/08/06 02:36:35 tgl Exp $ + * $Id: fd.h,v 1.37 2003/03/27 16:51:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -55,7 +55,7 @@ extern int max_files_per_process; /* Operations on virtual Files --- equivalent to Unix kernel file ops */ extern File FileNameOpenFile(FileName fileName, int fileFlags, int fileMode); extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode); -extern File OpenTemporaryFile(void); +extern File OpenTemporaryFile(bool keepOverTxn); extern void FileClose(File file); extern void FileUnlink(File file); extern int FileRead(File file, char *buffer, int amount); diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h index bbad436c049..bbf86ef4ca6 100644 --- a/src/include/tcop/dest.h +++ b/src/include/tcop/dest.h @@ -44,7 +44,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: dest.h,v 1.32 2002/09/04 20:31:45 momjian Exp $ + * $Id: dest.h,v 1.33 2003/03/27 16:51:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -70,7 +70,8 @@ typedef enum Remote, /* results sent to frontend process */ RemoteInternal, /* results sent to frontend process in * internal (binary) form */ - SPI /* results sent to SPI manager */ + SPI, /* results sent to SPI manager */ + Tuplestore /* results sent to Tuplestore */ } CommandDest; /* ---------------- diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h index c9ca8547ce2..0201b0684c3 100644 --- a/src/include/utils/portal.h +++ b/src/include/utils/portal.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: portal.h,v 1.39 2003/03/11 19:40:24 tgl Exp $ + * $Id: portal.h,v 1.40 2003/03/27 16:51:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,17 +18,45 @@ #include "executor/execdesc.h" #include "nodes/memnodes.h" +#include "utils/tuplestore.h" +/* + * We support three kinds of scroll behavior: + * + * (1) Neither NO SCROLL nor SCROLL was specified: to remain backward + * compatible, we allow backward fetches here, unless it would + * impose additional runtime overhead to do so. + * + * (2) NO SCROLL was specified: don't allow any backward fetches. + * + * (3) SCROLL was specified: allow all kinds of backward fetches, even + * if we need to take a slight performance hit to do so. + * + * Case #1 is converted to #2 or #3 by looking at the query itself and + * determining if scrollability can be supported without additional + * overhead. + */ +typedef enum +{ + DEFAULT_SCROLL, + DISABLE_SCROLL, + ENABLE_SCROLL +} ScrollType; typedef struct PortalData *Portal; typedef struct PortalData { char *name; /* Portal's name */ - MemoryContext heap; /* subsidiary memory */ + MemoryContext heap; /* memory for storing short-term data */ QueryDesc *queryDesc; /* Info about query associated with portal */ void (*cleanup) (Portal); /* Cleanup routine (optional) */ - bool backwardOK; /* is fetch backwards allowed? */ + ScrollType scrollType; /* Allow backward fetches? */ + bool holdOpen; /* hold open after txn ends? */ + TransactionId createXact; /* the xid of the creating txn */ + Tuplestorestate *holdStore; /* store for holdable cursors */ + MemoryContext holdContext; /* memory for long-term data */ + /* * atStart, atEnd and portalPos indicate the current cursor position. * portalPos is zero before the first row, N after fetching N'th row of @@ -58,11 +86,12 @@ typedef struct PortalData extern void EnablePortalManager(void); -extern void AtEOXact_portals(void); +extern void AtEOXact_portals(bool isCommit); extern Portal CreatePortal(const char *name); -extern void PortalDrop(Portal portal); +extern void PortalDrop(Portal portal, bool persistHoldable); extern Portal GetPortalByName(const char *name); extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc, void (*cleanup) (Portal portal)); +extern void PersistHoldablePortal(Portal portal); #endif /* PORTAL_H */ diff --git a/src/include/utils/tuplestore.h b/src/include/utils/tuplestore.h index 76fe9fb4287..dbc47ef29d6 100644 --- a/src/include/utils/tuplestore.h +++ b/src/include/utils/tuplestore.h @@ -17,7 +17,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: tuplestore.h,v 1.9 2003/03/09 03:34:10 tgl Exp $ + * $Id: tuplestore.h,v 1.10 2003/03/27 16:51:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -37,7 +37,8 @@ typedef struct Tuplestorestate Tuplestorestate; */ extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess, - int maxKBytes); + bool interTxn, + int maxKBytes); extern void tuplestore_puttuple(Tuplestorestate *state, void *tuple); |