summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/printtup.h8
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/executor/executor.h4
-rw-r--r--src/include/nodes/plannodes.h6
-rw-r--r--src/include/nodes/primnodes.h37
-rw-r--r--src/include/optimizer/planmain.h6
-rw-r--r--src/include/optimizer/tlist.h3
-rw-r--r--src/include/parser/parse_target.h3
-rw-r--r--src/include/tcop/dest.h8
9 files changed, 45 insertions, 34 deletions
diff --git a/src/include/access/printtup.h b/src/include/access/printtup.h
index 688a75cd2d..c4c92fb1bb 100644
--- a/src/include/access/printtup.h
+++ b/src/include/access/printtup.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: printtup.h,v 1.24 2003/05/05 00:44:56 tgl Exp $
+ * $Id: printtup.h,v 1.25 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,16 +18,16 @@
extern DestReceiver *printtup_create_DR(bool isBinary, bool sendDescrip);
-extern void SendRowDescriptionMessage(TupleDesc typeinfo);
+extern void SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist);
extern void debugSetup(DestReceiver *self, int operation,
- const char *portalName, TupleDesc typeinfo);
+ const char *portalName, TupleDesc typeinfo, List *targetlist);
extern void debugtup(HeapTuple tuple, TupleDesc typeinfo,
DestReceiver *self);
/* XXX these are really in executor/spi.c */
extern void spi_dest_setup(DestReceiver *self, int operation,
- const char *portalName, TupleDesc typeinfo);
+ const char *portalName, TupleDesc typeinfo, List *targetlist);
extern void spi_printtup(HeapTuple tuple, TupleDesc tupdesc,
DestReceiver *self);
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 0c14811682..74e36730c5 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catversion.h,v 1.185 2003/05/02 20:54:35 tgl Exp $
+ * $Id: catversion.h,v 1.186 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200305011
+#define CATALOG_VERSION_NO 200305051
#endif
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 9693435977..302bc2681c 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.92 2003/05/05 17:57:47 tgl Exp $
+ * $Id: executor.h,v 1.93 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -82,7 +82,7 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot);
/*
* prototypes from functions in execMain.c
*/
-extern void ExecutorStart(QueryDesc *queryDesc);
+extern void ExecutorStart(QueryDesc *queryDesc, bool explainOnly);
extern TupleTableSlot *ExecutorRun(QueryDesc *queryDesc,
ScanDirection direction, long count);
extern void ExecutorEnd(QueryDesc *queryDesc);
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 2ca16b6327..9db779d8bf 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.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: plannodes.h,v 1.64 2003/02/09 00:30:40 tgl Exp $
+ * $Id: plannodes.h,v 1.65 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -278,7 +278,9 @@ typedef struct Material
typedef struct Sort
{
Plan plan;
- int keycount;
+ int numCols; /* number of sort-key columns */
+ AttrNumber *sortColIdx; /* their indexes in the target list */
+ Oid *sortOperators; /* OIDs of operators to sort them by */
} Sort;
/* ---------------
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 35e2ab2627..558621c900 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: primnodes.h,v 1.81 2003/04/08 23:20:04 tgl Exp $
+ * $Id: primnodes.h,v 1.82 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,16 @@
* Resdom (Result Domain)
*
* Notes:
- * ressortgroupref is the parse/plan-time representation of ORDER BY and
+ *
+ * resno will normally be equal to the item's position in a targetlist,
+ * but the code generally tries to avoid relying on that (eg, we avoid
+ * using "nth()" rather than a search to find an item by resno).
+ *
+ * resname will be null if no name can easily be assigned to the column.
+ * But it should never be null for user-visible columns (i.e., non-junk
+ * columns in a toplevel targetlist).
+ *
+ * ressortgroupref is used in the representation of ORDER BY and
* GROUP BY items. Targetlist entries with ressortgroupref=0 are not
* sort/group items. If ressortgroupref>0, then this item is an ORDER BY or
* GROUP BY value. No two entries in a targetlist may have the same nonzero
@@ -39,27 +48,25 @@
* ressortgroupref means a more significant sort key.) The order of the
* associated SortClause or GroupClause lists determine the semantics.
*
- * reskey and reskeyop are the execution-time representation of sorting.
- * reskey must be zero in any non-sort-key item. The reskey of sort key
- * targetlist items for a sort plan node is 1,2,...,n for the n sort keys.
- * The reskeyop of each such targetlist item is the sort operator's OID.
- * reskeyop will be zero in non-sort-key items.
+ * resorigtbl/resorigcol identify the source of the column, if it is a
+ * simple reference to a column of a base table (or view). If it is not
+ * a simple reference, these fields are zeroes.
*
- * Both reskey and reskeyop are typically zero during parse/plan stages.
- * The executor does not pay any attention to ressortgroupref.
+ * If resjunk is true then the column is a working column (such as a sort key)
+ * that should be removed from the final output of the query.
*--------------------
*/
typedef struct Resdom
{
NodeTag type;
- AttrNumber resno; /* attribute number */
+ AttrNumber resno; /* attribute number (1..N) */
Oid restype; /* type of the value */
int32 restypmod; /* type-specific modifier of the value */
- char *resname; /* name of the resdom (could be NULL) */
- Index ressortgroupref;
- /* nonzero if referenced by a sort/group clause */
- Index reskey; /* order of key in a sort (for those > 0) */
- Oid reskeyop; /* sort operator's Oid */
+ char *resname; /* name of the column (could be NULL) */
+ Index ressortgroupref; /* nonzero if referenced by a
+ * sort/group clause */
+ Oid resorigtbl; /* OID of column's source table */
+ AttrNumber resorigcol; /* column's number in source table */
bool resjunk; /* set to true to eliminate the attribute
* from final target list */
} Resdom;
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index bd1d757e6a..35a85e311a 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.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: planmain.h,v 1.69 2003/03/10 03:53:52 tgl Exp $
+ * $Id: planmain.h,v 1.70 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,10 +30,10 @@ extern Plan *create_plan(Query *root, Path *best_path);
extern SubqueryScan *make_subqueryscan(List *qptlist, List *qpqual,
Index scanrelid, Plan *subplan);
extern Append *make_append(List *appendplans, bool isTarget, List *tlist);
-extern Sort *make_sort(Query *root, List *tlist,
- Plan *lefttree, int keycount);
extern Sort *make_sort_from_sortclauses(Query *root, List *tlist,
Plan *lefttree, List *sortcls);
+extern Sort *make_sort_from_groupcols(Query *root, List *groupcls,
+ AttrNumber *grpColIdx, Plan *lefttree);
extern Agg *make_agg(Query *root, List *tlist, List *qual,
AggStrategy aggstrategy,
int numGroupCols, AttrNumber *grpColIdx,
diff --git a/src/include/optimizer/tlist.h b/src/include/optimizer/tlist.h
index bce5db6c55..e2afc3ac82 100644
--- a/src/include/optimizer/tlist.h
+++ b/src/include/optimizer/tlist.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: tlist.h,v 1.34 2003/02/15 20:12:41 tgl Exp $
+ * $Id: tlist.h,v 1.35 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,7 +22,6 @@ extern Resdom *tlist_member(Node *node, List *targetlist);
extern void add_var_to_tlist(RelOptInfo *rel, Var *var);
extern TargetEntry *create_tl_element(Var *var, int resdomno);
-extern List *new_unsorted_tlist(List *targetlist);
extern List *flatten_tlist(List *tlist);
extern List *add_to_flat_tlist(List *tlist, List *vars);
diff --git a/src/include/parser/parse_target.h b/src/include/parser/parse_target.h
index b89ed3a30d..880673800a 100644
--- a/src/include/parser/parse_target.h
+++ b/src/include/parser/parse_target.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: parse_target.h,v 1.29 2003/02/13 05:53:46 momjian Exp $
+ * $Id: parse_target.h,v 1.30 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,6 +18,7 @@
extern List *transformTargetList(ParseState *pstate, List *targetlist);
+extern void markTargetListOrigins(ParseState *pstate, List *targetlist);
extern TargetEntry *transformTargetEntry(ParseState *pstate,
Node *node, Node *expr,
char *colname, bool resjunk);
diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h
index 5fbe9d33af..be2338b7f3 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.35 2003/05/05 00:44:56 tgl Exp $
+ * $Id: dest.h,v 1.36 2003/05/06 00:20:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -92,10 +92,12 @@ 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, int operation,
- const char *portalName, TupleDesc typeinfo);
+ const char *portalName,
+ TupleDesc typeinfo,
+ List *targetlist);
void (*cleanup) (DestReceiver *self);
/* Private fields might appear beyond this point... */
};