diff options
Diffstat (limited to 'src/backend/optimizer/plan/subselect.c')
| -rw-r--r-- | src/backend/optimizer/plan/subselect.c | 63 |
1 files changed, 14 insertions, 49 deletions
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c index 138e7d8063..aee5f4a1a1 100644 --- a/src/backend/optimizer/plan/subselect.c +++ b/src/backend/optimizer/plan/subselect.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.77 2003/06/24 23:14:43 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.78 2003/06/25 21:30:30 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ typedef struct finalize_primnode_context static List *convert_sublink_opers(List *lefthand, List *operOids, List *targetlist, int rtindex, - bool isExpr, List **righthandIds); + List **righthandIds); static bool subplan_is_hashable(SubLink *slink, SubPlan *node); static Node *replace_correlation_vars_mutator(Node *node, void *context); static Node *process_sublinks_mutator(Node *node, bool *isTopQual); @@ -299,12 +299,6 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual) */ node->subLinkType = slink->subLinkType; node->useOr = slink->useOr; - node->isExpr = slink->isExpr; - node->exprtype = InvalidOid; - node->elemtype = InvalidOid; - node->elmlen = 0; - node->elmbyval = false; - node->elmalign = '\0'; node->exprs = NIL; node->paramIds = NIL; node->useHashTable = false; @@ -380,7 +374,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual) exprs = convert_sublink_opers(lefthand, slink->operOids, plan->targetlist, - 0, node->isExpr, + 0, &node->paramIds); node->setParam = listCopy(node->paramIds); PlannerInitPlan = lappend(PlannerInitPlan, node); @@ -463,7 +457,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual) node->exprs = convert_sublink_opers(lefthand, slink->operOids, plan->targetlist, - 0, node->isExpr, + 0, &node->paramIds); /* @@ -505,7 +499,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual) static List * convert_sublink_opers(List *lefthand, List *operOids, List *targetlist, int rtindex, - bool isExpr, List **righthandIds) + List **righthandIds) { List *result = NIL; List *lst; @@ -560,38 +554,13 @@ convert_sublink_opers(List *lefthand, List *operOids, * are not expecting to have to resolve unknown Params, so * it's okay to pass a null pstate.) */ - if (!isExpr) - { - result = lappend(result, - make_op_expr(NULL, - tup, - leftop, - rightop, - exprType(leftop), - te->resdom->restype)); - } - else - { - Oid exprtype = te->resdom->restype; - Oid elemtype = get_element_type(exprtype); - - if (elemtype != InvalidOid) - result = lappend(result, - make_op_expr(NULL, - tup, - leftop, - rightop, - exprType(leftop), - elemtype)); - else - result = lappend(result, - make_op_expr(NULL, - tup, - leftop, - rightop, - exprType(leftop), - exprtype)); - } + result = lappend(result, + make_op_expr(NULL, + tup, + leftop, + rightop, + exprType(leftop), + te->resdom->restype)); ReleaseSysCache(tup); @@ -702,17 +671,13 @@ convert_IN_to_join(Query *parse, SubLink *sublink) /* * The sublink type must be "= ANY" --- that is, an IN operator. * (We require the operator name to be unqualified, which may be - * overly paranoid, or may not be.) It must not be an Expression - * sublink. + * overly paranoid, or may not be.) */ if (sublink->subLinkType != ANY_SUBLINK) return NULL; if (length(sublink->operName) != 1 || strcmp(strVal(lfirst(sublink->operName)), "=") != 0) return NULL; - if (sublink->isExpr) - return NULL; - /* * The sub-select must not refer to any Vars of the parent query. * (Vars of higher levels should be okay, though.) @@ -765,7 +730,7 @@ convert_IN_to_join(Query *parse, SubLink *sublink) exprs = convert_sublink_opers(sublink->lefthand, sublink->operOids, subselect->targetList, - rtindex, sublink->isExpr, + rtindex, &ininfo->sub_targetlist); return (Node *) make_ands_explicit(exprs); } |
