summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/executor/executor.h16
-rw-r--r--src/include/nodes/plannodes.h25
-rw-r--r--src/include/nodes/relation.h25
-rw-r--r--src/include/optimizer/pathnode.h7
-rw-r--r--src/include/optimizer/planmain.h6
-rw-r--r--src/include/utils/lsyscache.h9
6 files changed, 54 insertions, 34 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index ff537e7ddee..6e099374cff 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.133 2007/01/05 22:19:54 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.134 2007/01/10 18:06:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -84,14 +84,12 @@ extern bool execTuplesUnequal(TupleTableSlot *slot1,
AttrNumber *matchColIdx,
FmgrInfo *eqfunctions,
MemoryContext evalContext);
-extern FmgrInfo *execTuplesMatchPrepare(TupleDesc tupdesc,
- int numCols,
- AttrNumber *matchColIdx);
-extern void execTuplesHashPrepare(TupleDesc tupdesc,
- int numCols,
- AttrNumber *matchColIdx,
- FmgrInfo **eqfunctions,
- FmgrInfo **hashfunctions);
+extern FmgrInfo *execTuplesMatchPrepare(int numCols,
+ Oid *eqOperators);
+extern void execTuplesHashPrepare(int numCols,
+ Oid *eqOperators,
+ FmgrInfo **eqFunctions,
+ FmgrInfo **hashFunctions);
extern TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx,
FmgrInfo *eqfunctions,
FmgrInfo *hashfunctions,
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 44002a9d45d..c9aa190b33d 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.88 2007/01/09 02:14:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.89 2007/01/10 18:06:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -346,14 +346,23 @@ typedef struct NestLoop
/* ----------------
* merge join node
+ *
+ * The expected ordering of each mergeable column is described by a btree
+ * opfamily OID, a direction (BTLessStrategyNumber or BTGreaterStrategyNumber)
+ * and a nulls-first flag. Note that the two sides of each mergeclause may
+ * be of different datatypes, but they are ordered the same way according to
+ * the common opfamily. The operator in each mergeclause must be an equality
+ * operator of the indicated opfamily.
* ----------------
*/
typedef struct MergeJoin
{
Join join;
List *mergeclauses; /* mergeclauses as expression trees */
- List *mergefamilies; /* OID list of btree opfamilies */
- List *mergestrategies; /* integer list of btree strategies */
+ /* these are arrays, but have the same length as the mergeclauses list: */
+ Oid *mergeFamilies; /* per-clause OIDs of btree opfamilies */
+ int *mergeStrategies; /* per-clause ordering (ASC or DESC) */
+ bool *mergeNullsFirst; /* per-clause nulls ordering */
} MergeJoin;
/* ----------------
@@ -399,6 +408,7 @@ typedef struct Group
Plan plan;
int numCols; /* number of grouping columns */
AttrNumber *grpColIdx; /* their indexes in the target list */
+ Oid *grpOperators; /* equality operators to compare with */
} Group;
/* ---------------
@@ -428,6 +438,7 @@ typedef struct Agg
AggStrategy aggstrategy;
int numCols; /* number of grouping columns */
AttrNumber *grpColIdx; /* their indexes in the target list */
+ Oid *grpOperators; /* equality operators to compare with */
long numGroups; /* estimated number of groups in input */
} Agg;
@@ -439,7 +450,8 @@ typedef struct Unique
{
Plan plan;
int numCols; /* number of columns to check for uniqueness */
- AttrNumber *uniqColIdx; /* indexes into the target list */
+ AttrNumber *uniqColIdx; /* their indexes in the target list */
+ Oid *uniqOperators; /* equality operators to compare with */
} Unique;
/* ----------------
@@ -470,8 +482,9 @@ typedef struct SetOp
SetOpCmd cmd; /* what to do */
int numCols; /* number of columns to check for
* duplicate-ness */
- AttrNumber *dupColIdx; /* indexes into the target list */
- AttrNumber flagColIdx;
+ AttrNumber *dupColIdx; /* their indexes in the target list */
+ Oid *dupOperators; /* equality operators to compare with */
+ AttrNumber flagColIdx; /* where is the flag column, if any */
} SetOp;
/* ----------------
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 4e285a765ad..f7900377398 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.131 2007/01/09 02:14:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.132 2007/01/10 18:06:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -618,9 +618,11 @@ typedef JoinPath NestPath;
* A mergejoin path has these fields.
*
* path_mergeclauses lists the clauses (in the form of RestrictInfos)
- * that will be used in the merge. The parallel lists path_mergefamilies
- * and path_mergestrategies specify the merge semantics for each clause
- * (in effect, defining the relevant sort ordering for each clause).
+ * that will be used in the merge. The parallel arrays path_mergeFamilies,
+ * path_mergeStrategies, and path_mergeNullsFirst specify the merge semantics
+ * for each clause (i.e., define the relevant sort ordering for each clause).
+ * (XXX is this the most reasonable path-time representation? It's at least
+ * partially redundant with the pathkeys of the input paths.)
*
* Note that the mergeclauses are a subset of the parent relation's
* restriction-clause list. Any join clauses that are not mergejoinable
@@ -637,8 +639,10 @@ typedef struct MergePath
{
JoinPath jpath;
List *path_mergeclauses; /* join clauses to be used for merge */
- List *path_mergefamilies; /* OID list of btree opfamilies */
- List *path_mergestrategies; /* integer list of btree strategies */
+ /* these are arrays, but have the same length as the mergeclauses list: */
+ Oid *path_mergeFamilies; /* per-clause OIDs of opfamilies */
+ int *path_mergeStrategies; /* per-clause ordering (ASC or DESC) */
+ bool *path_mergeNullsFirst; /* per-clause nulls ordering */
List *outersortkeys; /* keys for explicit sort, if any */
List *innersortkeys; /* keys for explicit sort, if any */
} MergePath;
@@ -885,6 +889,9 @@ typedef struct OuterJoinInfo
* the order of joining and use special join methods at some join points.
* We record information about each such IN clause in an InClauseInfo struct.
* These structs are kept in the PlannerInfo node's in_info_list.
+ *
+ * Note: sub_targetlist is just a list of Vars or expressions; it does not
+ * contain TargetEntry nodes.
*/
typedef struct InClauseInfo
@@ -893,11 +900,7 @@ typedef struct InClauseInfo
Relids lefthand; /* base relids in lefthand expressions */
Relids righthand; /* base relids coming from the subselect */
List *sub_targetlist; /* targetlist of original RHS subquery */
-
- /*
- * Note: sub_targetlist is just a list of Vars or expressions; it does not
- * contain TargetEntry nodes.
- */
+ List *in_operators; /* OIDs of the IN's equality operator(s) */
} InClauseInfo;
/*
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
index b1e505cd6ae..fd5c78372ec 100644
--- a/src/include/optimizer/pathnode.h
+++ b/src/include/optimizer/pathnode.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/optimizer/pathnode.h,v 1.74 2007/01/05 22:19:56 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/pathnode.h,v 1.75 2007/01/10 18:06:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,8 +71,9 @@ extern MergePath *create_mergejoin_path(PlannerInfo *root,
List *restrict_clauses,
List *pathkeys,
List *mergeclauses,
- List *mergefamilies,
- List *mergestrategies,
+ Oid *mergefamilies,
+ int *mergestrategies,
+ bool *mergenullsfirst,
List *outersortkeys,
List *innersortkeys);
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index cb6ed70c0c5..0f6799338bb 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.96 2007/01/05 22:19:56 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.97 2007/01/10 18:06:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,11 +44,11 @@ extern Sort *make_sort_from_groupcols(PlannerInfo *root, List *groupcls,
AttrNumber *grpColIdx, Plan *lefttree);
extern Agg *make_agg(PlannerInfo *root, List *tlist, List *qual,
AggStrategy aggstrategy,
- int numGroupCols, AttrNumber *grpColIdx,
+ int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators,
long numGroups, int numAggs,
Plan *lefttree);
extern Group *make_group(PlannerInfo *root, List *tlist, List *qual,
- int numGroupCols, AttrNumber *grpColIdx,
+ int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators,
double numGroups,
Plan *lefttree);
extern Material *make_material(Plan *lefttree);
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 15d2b8a06d9..8d4c0d8e3ef 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.111 2007/01/09 02:14:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.112 2007/01/10 18:06:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,10 +37,15 @@ extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
int16 strategy);
extern bool get_op_mergejoin_info(Oid eq_op, Oid *left_sortop,
Oid *right_sortop, Oid *opfamily);
-extern bool get_op_compare_function(Oid opno, Oid *cmpfunc, bool *reverse);
+extern bool get_compare_function_for_ordering_op(Oid opno,
+ Oid *cmpfunc, bool *reverse);
+extern Oid get_equality_op_for_ordering_op(Oid opno);
+extern Oid get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type);
+extern Oid get_compatible_hash_operator(Oid opno, bool use_lhs_type);
extern Oid get_op_hash_function(Oid opno);
extern void get_op_btree_interpretation(Oid opno,
List **opfamilies, List **opstrats);
+extern bool ops_in_same_btree_opfamily(Oid opno1, Oid opno2);
extern Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype,
int16 procnum);
extern char *get_attname(Oid relid, AttrNumber attnum);