diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-12-23 00:43:13 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-12-23 00:43:13 +0000 |
| commit | a78fcfb5124379532ce35f3076679f04bd987d60 (patch) | |
| tree | 345204410d4f015a9d20ff55ecc38de3d371c459 /src/include/nodes | |
| parent | d31ccb6c3e73901c44865bfce3f5dd20774f7a89 (diff) | |
| download | postgresql-a78fcfb5124379532ce35f3076679f04bd987d60.tar.gz | |
Restructure operator classes to allow improved handling of cross-data-type
cases. Operator classes now exist within "operator families". While most
families are equivalent to a single class, related classes can be grouped
into one family to represent the fact that they are semantically compatible.
Cross-type operators are now naturally adjunct parts of a family, without
having to wedge them into a particular opclass as we had done originally.
This commit restructures the catalogs and cleans up enough of the fallout so
that everything still works at least as well as before, but most of the work
needed to actually improve the planner's behavior will come later. Also,
there are not yet CREATE/DROP/ALTER OPERATOR FAMILY commands; the only way
to create a new family right now is to allow CREATE OPERATOR CLASS to make
one by default. I owe some more documentation work, too. But that can all
be done in smaller pieces once this infrastructure is in place.
Diffstat (limited to 'src/include/nodes')
| -rw-r--r-- | src/include/nodes/parsenodes.h | 3 | ||||
| -rw-r--r-- | src/include/nodes/plannodes.h | 6 | ||||
| -rw-r--r-- | src/include/nodes/primnodes.h | 6 | ||||
| -rw-r--r-- | src/include/nodes/relation.h | 15 |
4 files changed, 19 insertions, 11 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index f79bf2907c..bc62c90f4d 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.334 2006/11/05 22:42:10 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.335 2006/12/23 00:43:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1318,6 +1318,7 @@ typedef struct CreateOpClassStmt { NodeTag type; List *opclassname; /* qualified name (list of Value strings) */ + List *opfamilyname; /* qualified name (ditto); NIL if omitted */ char *amname; /* name of index AM opclass is for */ TypeName *datatype; /* datatype of indexed column */ List *items; /* List of CreateOpClassItem nodes */ diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 5c2de28a41..e8250504eb 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.85 2006/08/02 01:59:47 joe Exp $ + * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.86 2006/12/23 00:43:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -351,7 +351,9 @@ typedef struct NestLoop typedef struct MergeJoin { Join join; - List *mergeclauses; + List *mergeclauses; /* mergeclauses as expression trees */ + List *mergefamilies; /* OID list of btree opfamilies */ + List *mergestrategies; /* integer list of btree strategies */ } MergeJoin; /* ---------------- diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 9654181bc3..5946300c97 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.119 2006/12/21 16:05:16 petere Exp $ + * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.120 2006/12/23 00:43:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -654,7 +654,7 @@ typedef struct RowExpr * * We support row comparison for any operator that can be determined to * act like =, <>, <, <=, >, or >= (we determine this by looking for the - * operator in btree opclasses). Note that the same operator name might + * operator in btree opfamilies). Note that the same operator name might * map to a different operator for each pair of row elements, since the * element datatypes can vary. * @@ -679,7 +679,7 @@ typedef struct RowCompareExpr Expr xpr; RowCompareType rctype; /* LT LE GE or GT, never EQ or NE */ List *opnos; /* OID list of pairwise comparison ops */ - List *opclasses; /* OID list of containing operator classes */ + List *opfamilies; /* OID list of containing operator families */ List *largs; /* the left-hand input arguments */ List *rargs; /* the right-hand input arguments */ } RowCompareExpr; diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index d39e924227..955773d147 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.128 2006/10/04 00:30:09 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.129 2006/12/23 00:43:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -300,11 +300,11 @@ typedef struct RelOptInfo * and indexes, but that created confusion without actually doing anything * useful. So now we have a separate IndexOptInfo struct for indexes. * - * classlist[], indexkeys[], and ordering[] have ncolumns entries. + * opfamily[], indexkeys[], and ordering[] have ncolumns entries. * Zeroes in the indexkeys[] array indicate index columns that are * expressions; there is one element in indexprs for each such column. * - * Note: for historical reasons, the classlist and ordering arrays have + * Note: for historical reasons, the opfamily and ordering arrays have * an extra entry that is always zero. Some code scans until it sees a * zero entry, rather than looking at ncolumns. * @@ -326,7 +326,7 @@ typedef struct IndexOptInfo /* index descriptor information */ int ncolumns; /* number of columns in index */ - Oid *classlist; /* OIDs of operator classes for columns */ + Oid *opfamily; /* OIDs of operator families for columns */ int *indexkeys; /* column numbers of index's keys, or 0 */ Oid *ordering; /* OIDs of sort operators for each column */ Oid relam; /* OID of the access method (in pg_am) */ @@ -611,7 +611,9 @@ 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. + * 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). * * Note that the mergeclauses are a subset of the parent relation's * restriction-clause list. Any join clauses that are not mergejoinable @@ -628,6 +630,8 @@ 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 */ List *outersortkeys; /* keys for explicit sort, if any */ List *innersortkeys; /* keys for explicit sort, if any */ } MergePath; @@ -780,6 +784,7 @@ typedef struct RestrictInfo Oid mergejoinoperator; /* copy of clause operator */ Oid left_sortop; /* leftside sortop needed for mergejoin */ Oid right_sortop; /* rightside sortop needed for mergejoin */ + Oid mergeopfamily; /* btree opfamily relating these ops */ /* cache space for mergeclause processing; NIL if not yet set */ List *left_pathkey; /* canonical pathkey for left side */ |
