summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/pg_list.h5
-rw-r--r--src/include/nodes/relation.h12
-rw-r--r--src/include/optimizer/restrictinfo.h6
3 files changed, 20 insertions, 3 deletions
diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h
index bc42917a355..5bf17ceb14e 100644
--- a/src/include/nodes/pg_list.h
+++ b/src/include/nodes/pg_list.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: pg_list.h,v 1.36 2003/05/28 22:32:50 tgl Exp $
+ * $Id: pg_list.h,v 1.37 2003/06/15 22:51:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -140,6 +140,8 @@ typedef struct FastList
} FastList;
#define FastListInit(fl) ( (fl)->head = (fl)->tail = NIL )
+#define FastListFromList(fl, l) \
+ ( (fl)->head = (l), (fl)->tail = llastnode((fl)->head) )
#define FastListValue(fl) ( (fl)->head )
@@ -166,6 +168,7 @@ extern void FastConcFast(FastList *fl, FastList *fl2);
extern void *nth(int n, List *l);
extern int length(List *list);
extern void *llast(List *list);
+extern List *llastnode(List *list);
extern bool member(void *datum, List *list);
extern bool ptrMember(void *datum, List *list);
extern bool intMember(int datum, List *list);
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 4f770b7ca10..8392ab505bd 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.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: relation.h,v 1.80 2003/05/28 16:04:02 tgl Exp $
+ * $Id: relation.h,v 1.81 2003/06/15 22:51:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -340,6 +340,15 @@ typedef struct Path
* Also note that indexquals lists do not contain RestrictInfo nodes,
* just bare clause expressions.
*
+ * 'indexjoinclauses' is NIL for an ordinary indexpath (one that does not
+ * use any join clauses in the index conditions). For an innerjoin indexpath,
+ * it has the same structure as 'indexqual', but references the RestrictInfo
+ * nodes from which the indexqual was built, rather than the bare clause
+ * expressions. (Note: there isn't necessarily a one-to-one correspondence
+ * between RestrictInfos and expressions, because of expansion of special
+ * indexable operators.) We need this so that we can eliminate redundant
+ * join clauses when plans are built.
+ *
* 'indexscandir' is one of:
* ForwardScanDirection: forward scan of an ordered index
* BackwardScanDirection: backward scan of an ordered index
@@ -360,6 +369,7 @@ typedef struct IndexPath
Path path;
List *indexinfo;
List *indexqual;
+ List *indexjoinclauses;
ScanDirection indexscandir;
double rows; /* estimated number of result tuples */
} IndexPath;
diff --git a/src/include/optimizer/restrictinfo.h b/src/include/optimizer/restrictinfo.h
index 997d4ab8c52..19c3435c3e5 100644
--- a/src/include/optimizer/restrictinfo.h
+++ b/src/include/optimizer/restrictinfo.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: restrictinfo.h,v 1.16 2002/11/24 21:52:15 tgl Exp $
+ * $Id: restrictinfo.h,v 1.17 2003/06/15 22:51:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,5 +23,9 @@ extern void get_actual_join_clauses(List *restrictinfo_list,
extern List *remove_redundant_join_clauses(Query *root,
List *restrictinfo_list,
JoinType jointype);
+extern List *select_nonredundant_join_clauses(Query *root,
+ List *restrictinfo_list,
+ List *reference_list,
+ JoinType jointype);
#endif /* RESTRICTINFO_H */