aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/pathkeys.c
diff options
context:
space:
mode:
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