aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/pathkeys.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-12-12 15:49:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-12-12 15:49:42 +0000
commita0bf885f9eaccadd23b766ecbc064f17f06ae883 (patch)
tree62b65e5cf1a8ec02ece3a98c15457ddff018bb94 /src/backend/optimizer/path/pathkeys.c
parentdebb072886efcb15e7f0825e35b168afe316d37d (diff)
downloadpostgresql-a0bf885f9eaccadd23b766ecbc064f17f06ae883.tar.gz
postgresql-a0bf885f9eaccadd23b766ecbc064f17f06ae883.zip
Phase 2 of read-only-plans project: restructure expression-tree nodes
so that all executable expression nodes inherit from a common supertype Expr. This is somewhat of an exercise in code purity rather than any real functional advance, but getting rid of the extra Oper or Func node formerly used in each operator or function call should provide at least a little space and speed improvement. initdb forced by changes in stored-rules representation.
Diffstat (limited to 'src/backend/optimizer/path/pathkeys.c')
-rw-r--r--src/backend/optimizer/path/pathkeys.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/backend/optimizer/path/pathkeys.c b/src/backend/optimizer/path/pathkeys.c
index 350c761165b..af0b61a4034 100644
--- a/src/backend/optimizer/path/pathkeys.c
+++ b/src/backend/optimizer/path/pathkeys.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.41 2002/09/18 21:35:21 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.42 2002/12/12 15:49:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -514,14 +514,16 @@ build_index_pathkeys(Query *root,
if (index->indproc)
{
/* Functional index: build a representation of the function call */
- Func *funcnode = makeNode(Func);
+ Expr *funcnode;
List *funcargs = NIL;
- funcnode->funcid = index->indproc;
- funcnode->funcresulttype = get_func_rettype(index->indproc);
- funcnode->funcretset = false; /* can never be a set */
- funcnode->funcformat = COERCE_DONTCARE; /* to match any user expr */
- funcnode->func_fcache = NULL;
+ sortop = *ordering;
+ if (ScanDirectionIsBackward(scandir))
+ {
+ sortop = get_commutator(sortop);
+ if (sortop == InvalidOid)
+ return NIL; /* oops, no reverse sort operator? */
+ }
while (*indexkeys != 0)
{
@@ -530,17 +532,14 @@ build_index_pathkeys(Query *root,
indexkeys++;
}
- sortop = *ordering;
- if (ScanDirectionIsBackward(scandir))
- {
- sortop = get_commutator(sortop);
- if (sortop == InvalidOid)
- return NIL; /* oops, no reverse sort operator? */
- }
+ funcnode = make_funcclause(index->indproc,
+ get_func_rettype(index->indproc),
+ false, /* cannot be a set */
+ COERCE_DONTCARE, /* to match any user expr */
+ funcargs);
/* Make a one-sublist pathkeys list for the function expression */
- item = makePathKeyItem((Node *) make_funcclause(funcnode, funcargs),
- sortop);
+ item = makePathKeyItem((Node *) funcnode, sortop);
retval = makeList1(make_canonical_pathkey(root, item));
}
else