summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2008-11-30 20:51:25 +0000
committerTom Lane2008-11-30 20:51:25 +0000
commitc1f3073333d01987ac9c3e5f6c197b9e2afc3ba9 (patch)
treeb70ddff5404c442ec13a5c182346984d4300f6da /src/include
parent3f936aacc057e4b391ab953fea2ffb689a12a8bc (diff)
Clean up the API for DestReceiver objects by eliminating the assumption
that a Portal is a useful and sufficient additional argument for CreateDestReceiver --- it just isn't, in most cases. Instead formalize the approach of passing any needed parameters to the receiver separately. One unexpected benefit of this change is that we can declare typedef Portal in a less surprising location. This patch is just code rearrangement and doesn't change any functionality. I'll tackle the HOLD-cursor-vs-toast problem in a follow-on patch.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/printtup.h8
-rw-r--r--src/include/executor/tstoreReceiver.h9
-rw-r--r--src/include/tcop/dest.h14
-rw-r--r--src/include/utils/portal.h7
4 files changed, 21 insertions, 17 deletions
diff --git a/src/include/access/printtup.h b/src/include/access/printtup.h
index 4f2fcbf41d..3249162ba8 100644
--- a/src/include/access/printtup.h
+++ b/src/include/access/printtup.h
@@ -7,16 +7,18 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/printtup.h,v 1.36 2008/01/01 19:45:56 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/printtup.h,v 1.37 2008/11/30 20:51:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PRINTTUP_H
#define PRINTTUP_H
-#include "tcop/dest.h"
+#include "utils/portal.h"
-extern DestReceiver *printtup_create_DR(CommandDest dest, Portal portal);
+extern DestReceiver *printtup_create_DR(CommandDest dest);
+
+extern void SetRemoteDestReceiverParams(DestReceiver *self, Portal portal);
extern void SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist,
int16 *formats);
diff --git a/src/include/executor/tstoreReceiver.h b/src/include/executor/tstoreReceiver.h
index d4ea0b2b1d..c304c1fce9 100644
--- a/src/include/executor/tstoreReceiver.h
+++ b/src/include/executor/tstoreReceiver.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/executor/tstoreReceiver.h,v 1.10 2008/01/01 19:45:57 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/executor/tstoreReceiver.h,v 1.11 2008/11/30 20:51:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +19,10 @@
#include "utils/tuplestore.h"
-extern DestReceiver *CreateTuplestoreDestReceiver(Tuplestorestate *tStore,
- MemoryContext tContext);
+extern DestReceiver *CreateTuplestoreDestReceiver(void);
+
+extern void SetTuplestoreDestReceiverParams(DestReceiver *self,
+ Tuplestorestate *tStore,
+ MemoryContext tContext);
#endif /* TSTORE_RECEIVER_H */
diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h
index 5522f78c68..508b7ab378 100644
--- a/src/include/tcop/dest.h
+++ b/src/include/tcop/dest.h
@@ -35,6 +35,12 @@
* The same receiver object may be re-used multiple times; eventually it is
* destroyed by calling its rDestroy method.
*
+ * In some cases, receiver objects require additional parameters that must
+ * be passed to them after calling CreateDestReceiver. Since the set of
+ * parameters varies for different receiver types, this is not handled by
+ * this module, but by direct calls from the calling code to receiver type
+ * specific functions.
+ *
* The DestReceiver object returned by CreateDestReceiver may be a statically
* allocated object (for destination types that require no local state),
* in which case rDestroy is a no-op. Alternatively it can be a palloc'd
@@ -54,7 +60,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/tcop/dest.h,v 1.55 2008/10/31 19:37:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/tcop/dest.h,v 1.56 2008/11/30 20:51:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -120,14 +126,10 @@ struct _DestReceiver
extern DestReceiver *None_Receiver; /* permanent receiver for DestNone */
-/* This is a forward reference to utils/portal.h */
-
-typedef struct PortalData *Portal;
-
/* The primary destination management functions */
extern void BeginCommand(const char *commandTag, CommandDest dest);
-extern DestReceiver *CreateDestReceiver(CommandDest dest, Portal portal);
+extern DestReceiver *CreateDestReceiver(CommandDest dest);
extern void EndCommand(const char *commandTag, CommandDest dest);
/* Additional functions that go with destination management, more or less. */
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index c420d4d71e..c6ccbf493e 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.79 2008/07/18 20:26:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.80 2008/11/30 20:51:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -102,10 +102,7 @@ typedef enum PortalStatus
PORTAL_FAILED /* portal got error (can't re-run it) */
} PortalStatus;
-/*
- * Note: typedef Portal is declared in tcop/dest.h as
- * typedef struct PortalData *Portal;
- */
+typedef struct PortalData *Portal;
typedef struct PortalData
{