diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/printtup.h | 7 | ||||
-rw-r--r-- | src/include/executor/execdefs.h | 19 | ||||
-rw-r--r-- | src/include/executor/execdesc.h | 9 | ||||
-rw-r--r-- | src/include/executor/executor.h | 4 | ||||
-rw-r--r-- | src/include/tcop/dest.h | 36 |
5 files changed, 34 insertions, 41 deletions
diff --git a/src/include/access/printtup.h b/src/include/access/printtup.h index ff775eb2697..c1d8db17adb 100644 --- a/src/include/access/printtup.h +++ b/src/include/access/printtup.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: printtup.h,v 1.18 2001/11/05 17:46:31 momjian Exp $ + * $Id: printtup.h,v 1.19 2002/02/27 19:35:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -18,9 +18,10 @@ extern DestReceiver *printtup_create_DR(bool isBinary); -extern void showatts(char *name, TupleDesc attinfo); +extern void debugSetup(DestReceiver *self, int operation, + const char *portalName, TupleDesc typeinfo); extern void debugtup(HeapTuple tuple, TupleDesc typeinfo, - DestReceiver *self); + DestReceiver *self); /* XXX this one is really in executor/spi.c */ extern void spi_printtup(HeapTuple tuple, TupleDesc tupdesc, diff --git a/src/include/executor/execdefs.h b/src/include/executor/execdefs.h index b6e71957716..bdb4dce13c6 100644 --- a/src/include/executor/execdefs.h +++ b/src/include/executor/execdefs.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: execdefs.h,v 1.11 2001/11/05 17:46:33 momjian Exp $ + * $Id: execdefs.h,v 1.12 2002/02/27 19:35:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -15,23 +15,6 @@ #define EXECDEFS_H /* ---------------- - * ExecutePlan() tuplecount definitions - * ---------------- - */ -#define ALL_TUPLES 0 /* return all tuples */ -#define ONE_TUPLE 1 /* return only one tuple */ - -/* ---------------- - * constants used by ExecMain - * ---------------- - */ -#define EXEC_RUN 3 -#define EXEC_FOR 4 -#define EXEC_BACK 5 -#define EXEC_RETONE 6 -#define EXEC_RESULT 7 - -/* ---------------- * Merge Join states * ---------------- */ diff --git a/src/include/executor/execdesc.h b/src/include/executor/execdesc.h index 55bf52ed38d..87915e9c07e 100644 --- a/src/include/executor/execdesc.h +++ b/src/include/executor/execdesc.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: execdesc.h,v 1.17 2001/11/05 17:46:33 momjian Exp $ + * $Id: execdesc.h,v 1.18 2002/02/27 19:35:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,7 @@ #include "nodes/plannodes.h" #include "tcop/dest.h" + /* ---------------- * query descriptor: * a QueryDesc encapsulates everything that the executor @@ -31,10 +32,14 @@ typedef struct QueryDesc Query *parsetree; Plan *plantree; CommandDest dest; /* the destination output of the execution */ + const char *portalName; /* name of portal, or NULL */ + + TupleDesc tupDesc; /* set by ExecutorStart */ } QueryDesc; /* in pquery.c */ extern QueryDesc *CreateQueryDesc(Query *parsetree, Plan *plantree, - CommandDest dest); + CommandDest dest, const char *portalName); + #endif /* EXECDESC_H */ diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index c089a47731f..63bc10f79dc 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: executor.h,v 1.62 2002/02/19 20:11:19 tgl Exp $ + * $Id: executor.h,v 1.63 2002/02/27 19:35:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -50,7 +50,7 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot); */ extern TupleDesc ExecutorStart(QueryDesc *queryDesc, EState *estate); extern TupleTableSlot *ExecutorRun(QueryDesc *queryDesc, EState *estate, - int feature, long count); + ScanDirection direction, long count); extern void ExecutorEnd(QueryDesc *queryDesc, EState *estate); extern void ExecConstraints(char *caller, ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate); diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h index d5ac420ce6e..c96133759d5 100644 --- a/src/include/tcop/dest.h +++ b/src/include/tcop/dest.h @@ -1,11 +1,13 @@ /*------------------------------------------------------------------------- * * dest.h - * Whenever the backend executes a query, the results - * have to go someplace. + * support for communication destinations + * + * Whenever the backend executes a query, the results + * have to go someplace. * * - stdout is the destination only when we are running a - * backend without a postmaster and are returning results + * standalone backend (no postmaster) and are returning results * back to an interactive user. * * - a remote process is the destination when we are @@ -14,15 +16,21 @@ * to the frontend via the functions in backend/libpq. * * - None is the destination when the system executes - * a query internally. This is not used now but it may be - * useful for the parallel optimiser/executor. + * a query internally. The results are discarded. * * dest.c defines three functions that implement destination management: * - * BeginCommand: initialize the destination. + * BeginCommand: initialize the destination at start of command. * DestToFunction: return a pointer to a struct of destination-specific * receiver functions. - * EndCommand: clean up the destination when output is complete. + * EndCommand: clean up the destination at end of command. + * + * BeginCommand/EndCommand are executed once per received SQL query. + * + * DestToFunction, and the receiver functions it links to, are executed + * each time we run the executor to produce tuples, which may occur + * multiple times per received query (eg, due to additional queries produced + * by rewrite rules). * * The DestReceiver object returned by DestToFunction may be a statically * allocated object (for destination types that require no local state) @@ -32,14 +40,11 @@ * by casting the DestReceiver* pointer passed to them. * The palloc'd object is pfree'd by the DestReceiver's cleanup function. * - * XXX FIXME: the initialization and cleanup code that currently appears - * in-line in BeginCommand and EndCommand probably should be moved out - * to routines associated with each destination receiver type. * * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: dest.h,v 1.29 2002/02/26 22:47:11 tgl Exp $ + * $Id: dest.h,v 1.30 2002/02/27 19:36:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -80,18 +85,17 @@ struct _DestReceiver { /* Called for each tuple to be output: */ void (*receiveTuple) (HeapTuple tuple, TupleDesc typeinfo, - DestReceiver *self); + DestReceiver *self); /* Initialization and teardown: */ - void (*setup) (DestReceiver *self, TupleDesc typeinfo); + void (*setup) (DestReceiver *self, int operation, + const char *portalName, TupleDesc typeinfo); void (*cleanup) (DestReceiver *self); /* Private fields might appear beyond this point... */ }; /* The primary destination management functions */ -extern void BeginCommand(char *pname, int operation, TupleDesc attinfo, - bool isIntoRel, bool isIntoPortal, char *tag, - CommandDest dest); +extern void BeginCommand(const char *commandTag, CommandDest dest); extern DestReceiver *DestToFunction(CommandDest dest); extern void EndCommand(const char *commandTag, CommandDest dest); |