diff options
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 21 | ||||
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 26 |
2 files changed, 14 insertions, 33 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 977cbe0a5e4..fe6f38eee85 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.125 2003/01/12 22:35:29 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.126 2003/01/15 19:35:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1754,8 +1754,8 @@ mergejoinscansel(Query *root, Node *clause, if (!is_opclause(clause)) return; /* shouldn't happen */ opno = ((OpExpr *) clause)->opno; - left = get_leftop((Expr *) clause); - right = get_rightop((Expr *) clause); + left = (Var *) get_leftop((Expr *) clause); + right = (Var *) get_rightop((Expr *) clause); if (!right) return; /* shouldn't happen */ @@ -1766,8 +1766,6 @@ mergejoinscansel(Query *root, Node *clause, /* Verify mergejoinability and get left and right "<" operators */ if (!op_mergejoinable(opno, - left->vartype, - right->vartype, &lsortop, &rsortop)) return; /* shouldn't happen */ @@ -1893,17 +1891,6 @@ estimate_num_groups(Query *root, List *groupClauses, double input_rows) varshere = pull_var_clause(groupexpr, false); /* - * Replace any JOIN alias Vars with the underlying Vars. (This - * is not really right for FULL JOIN ...) - */ - if (root->hasJoinRTEs) - { - varshere = (List *) flatten_join_alias_vars((Node *) varshere, - root->rtable, - true); - varshere = pull_var_clause((Node *) varshere, false); - } - /* * If we find any variable-free GROUP BY item, then either it is * a constant (and we can ignore it) or it contains a volatile * function; in the latter case we punt and assume that each input @@ -1963,7 +1950,7 @@ estimate_num_groups(Query *root, List *groupClauses, double input_rows) l2 = lnext(l2); if (var->varno != varinfo->var->varno && - vars_known_equal(root, var, varinfo->var)) + exprs_known_equal(root, (Node *) var, (Node *) varinfo->var)) { /* Found a match */ if (varinfo->ndistinct <= ndistinct) diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 56dabcd7542..a6c838974c0 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.88 2002/12/05 04:04:44 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.89 2003/01/15 19:35:44 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -315,11 +315,11 @@ get_opname(Oid opno) /* * op_mergejoinable * - * Returns the left and right sort operators and types corresponding to a - * mergejoinable operator, or nil if the operator is not mergejoinable. + * Returns the left and right sort operators corresponding to a + * mergejoinable operator, or false if the operator is not mergejoinable. */ bool -op_mergejoinable(Oid opno, Oid ltype, Oid rtype, Oid *leftOp, Oid *rightOp) +op_mergejoinable(Oid opno, Oid *leftOp, Oid *rightOp) { HeapTuple tp; bool result = false; @@ -332,9 +332,7 @@ op_mergejoinable(Oid opno, Oid ltype, Oid rtype, Oid *leftOp, Oid *rightOp) Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); if (optup->oprlsortop && - optup->oprrsortop && - optup->oprleft == ltype && - optup->oprright == rtype) + optup->oprrsortop) { *leftOp = optup->oprlsortop; *rightOp = optup->oprrsortop; @@ -391,14 +389,13 @@ op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop, /* * op_hashjoinable * - * Returns the hash operator corresponding to a hashjoinable operator, - * or InvalidOid if the operator is not hashjoinable. + * Returns true if the operator is hashjoinable. */ -Oid -op_hashjoinable(Oid opno, Oid ltype, Oid rtype) +bool +op_hashjoinable(Oid opno) { HeapTuple tp; - Oid result = InvalidOid; + bool result = false; tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno), @@ -407,10 +404,7 @@ op_hashjoinable(Oid opno, Oid ltype, Oid rtype) { Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); - if (optup->oprcanhash && - optup->oprleft == ltype && - optup->oprright == rtype) - result = opno; + result = optup->oprcanhash; ReleaseSysCache(tp); } return result; |