diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-05-06 20:26:28 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-05-06 20:26:28 +0000 |
| commit | 79913910d4b518a42c893b6dd459656798ffa591 (patch) | |
| tree | f0cd5c25dff8d026b9d8d4736717a4d38c278134 /src/include/executor | |
| parent | 299fbb4b379003557f79d2732a85ece168d04ec4 (diff) | |
| download | postgresql-79913910d4b518a42c893b6dd459656798ffa591.tar.gz | |
Restructure command destination handling so that we pass around
DestReceiver pointers instead of just CommandDest values. The DestReceiver
is made at the point where the destination is selected, rather than
deep inside the executor. This cleans up the original kluge implementation
of tstoreReceiver.c, and makes it easy to support retrieving results
from utility statements inside portals. Thus, you can now do fun things
like Bind and Execute a FETCH or EXPLAIN command, and it'll all work
as expected (e.g., you can Describe the portal, or use Execute's count
parameter to suspend the output partway through). Implementation involves
stuffing the utility command's output into a Tuplestore, which would be
kind of annoying for huge output sets, but should be quite acceptable
for typical uses of utility commands.
Diffstat (limited to 'src/include/executor')
| -rw-r--r-- | src/include/executor/execdesc.h | 6 | ||||
| -rw-r--r-- | src/include/executor/executor.h | 8 | ||||
| -rw-r--r-- | src/include/executor/tstoreReceiver.h | 7 |
3 files changed, 13 insertions, 8 deletions
diff --git a/src/include/executor/execdesc.h b/src/include/executor/execdesc.h index 27148bb1d8..9c54ed1d64 100644 --- a/src/include/executor/execdesc.h +++ b/src/include/executor/execdesc.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: execdesc.h,v 1.22 2002/12/15 16:17:54 tgl Exp $ + * $Id: execdesc.h,v 1.23 2003/05/06 20:26:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -33,7 +33,7 @@ typedef struct QueryDesc CmdType operation; /* CMD_SELECT, CMD_UPDATE, etc. */ Query *parsetree; /* rewritten parsetree */ Plan *plantree; /* planner's output */ - CommandDest dest; /* the destination output of the execution */ + DestReceiver *dest; /* the destination for tuple output */ const char *portalName; /* name of portal, or NULL */ ParamListInfo params; /* param values being passed in */ bool doInstrument; /* TRUE requests runtime instrumentation */ @@ -46,7 +46,7 @@ typedef struct QueryDesc /* in pquery.c */ extern QueryDesc *CreateQueryDesc(Query *parsetree, Plan *plantree, - CommandDest dest, const char *portalName, + DestReceiver *dest, const char *portalName, ParamListInfo params, bool doInstrument); diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 302bc2681c..707b8c9fa6 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.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: executor.h,v 1.93 2003/05/06 00:20:33 tgl Exp $ + * $Id: executor.h,v 1.94 2003/05/06 20:26:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -161,16 +161,18 @@ extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate); extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate, TupleDesc tupType); extern TupleDesc ExecTypeFromTL(List *targetList, bool hasoid); +extern TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid); extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg); typedef struct TupOutputState { /* use "struct" here to allow forward reference */ struct AttInMetadata *metadata; - DestReceiver *destfunc; + DestReceiver *dest; } TupOutputState; -extern TupOutputState *begin_tup_output_tupdesc(CommandDest dest, TupleDesc tupdesc); +extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest, + TupleDesc tupdesc); extern void do_tup_output(TupOutputState *tstate, char **values); extern void do_text_output_multiline(TupOutputState *tstate, char *text); extern void end_tup_output(TupOutputState *tstate); diff --git a/src/include/executor/tstoreReceiver.h b/src/include/executor/tstoreReceiver.h index e5fb7a9509..e7d9497ffe 100644 --- a/src/include/executor/tstoreReceiver.h +++ b/src/include/executor/tstoreReceiver.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: tstoreReceiver.h,v 1.1 2003/03/27 16:55:11 momjian Exp $ + * $Id: tstoreReceiver.h,v 1.2 2003/05/06 20:26:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,10 @@ #define TSTORE_RECEIVER_H #include "tcop/dest.h" +#include "utils/tuplestore.h" -extern DestReceiver *tstoreReceiverCreateDR(void); + +extern DestReceiver *CreateTuplestoreDestReceiver(Tuplestorestate *tStore, + MemoryContext tContext); #endif /* TSTORE_RECEIVER_H */ |
