提交 45a0ba86 编写于 作者: H Heikki Linnakangas

Remove kludge used to pull typmod from subquery.

It's no longer needed, as Params carry a typmod now.
上级 424460c9
......@@ -1131,8 +1131,7 @@ convert_IN_to_join(PlannerInfo *root, List** rtrlist_inout, SubLink *sublink)
return convert_testexpr(root,
sublink->testexpr,
rtindex,
&ininfo->sub_targetlist,
subselect->targetList);
&ininfo->sub_targetlist);
} /* convert_IN_to_join */
......@@ -1417,7 +1416,6 @@ static Node *
make_lasj_quals(PlannerInfo *root, SubLink * sublink, int subquery_indx)
{
Expr *join_pred;
Query *subselect = (Query *) sublink->subselect;
List *subtlist = NIL;
Assert(sublink->subLinkType == ALL_SUBLINK);
......@@ -1425,8 +1423,7 @@ make_lasj_quals(PlannerInfo *root, SubLink * sublink, int subquery_indx)
join_pred = (Expr *) convert_testexpr(root,
sublink->testexpr,
subquery_indx,
&subtlist,
subselect->targetList);
&subtlist);
join_pred = canonicalize_qual(make_notclause(join_pred));
......
......@@ -42,7 +42,6 @@ typedef struct convert_testexpr_context
PlannerInfo *root;
int rtindex; /* RT index for Vars, or 0 for Params */
List *righthandIds; /* accumulated list of Vars or Param IDs */
List *sub_tlist; /* subselect targetlist (if given) */
} convert_testexpr_context;
typedef struct process_sublinks_context
......@@ -561,8 +560,7 @@ build_subplan(PlannerInfo *root, Plan *plan, List *rtable,
result = convert_testexpr(root,
testexpr,
0,
&splan->paramIds,
NIL);
&splan->paramIds);
splan->setParam = list_copy(splan->paramIds);
splan->is_initplan = true;
......@@ -596,8 +594,7 @@ build_subplan(PlannerInfo *root, Plan *plan, List *rtable,
splan->testexpr = convert_testexpr(root,
testexpr,
0,
&splan->paramIds,
NIL);
&splan->paramIds);
result = (Node *) splan;
......@@ -666,10 +663,6 @@ build_subplan(PlannerInfo *root, Plan *plan, List *rtable,
* of the Var nodes are returned in *righthandIds (this is a bit of a type
* cheat, but we can get away with it).
*
* The subquery targetlist need be supplied only if rtindex is not 0.
* We consult it to extract the correct typmods for the created Vars.
* (XXX this is a kluge that could go away if Params carried typmod.)
*
* The given testexpr has already been recursively processed by
* process_sublinks_mutator. Hence it can no longer contain any
* PARAM_SUBLINK Params for lower SubLink nodes; we can safely assume that
......@@ -678,8 +671,7 @@ build_subplan(PlannerInfo *root, Plan *plan, List *rtable,
Node *
convert_testexpr(PlannerInfo *root, Node *testexpr,
int rtindex,
List **righthandIds,
List *sub_tlist)
List **righthandIds)
{
Node *result;
convert_testexpr_context context;
......@@ -687,7 +679,6 @@ convert_testexpr(PlannerInfo *root, Node *testexpr,
context.root = root;
context.rtindex = rtindex;
context.righthandIds = NIL;
context.sub_tlist = sub_tlist;
result = convert_testexpr_mutator(testexpr, &context);
*righthandIds = context.righthandIds;
return result;
......@@ -719,19 +710,6 @@ convert_testexpr_mutator(Node *node,
/* Make the Var node representing the subplan's result */
Var *newvar;
/*
* XXX kluge: since Params don't carry typmod, we have to
* look into the subquery targetlist to find out the right
* typmod to assign to the Var.
*/
TargetEntry *ste = get_tle_by_resno(context->sub_tlist,
param->paramid);
if (ste == NULL || ste->resjunk)
elog(ERROR, "subquery output %d not found",
param->paramid);
Assert(param->paramtype == exprType((Node *) ste->expr));
newvar = makeVar(context->rtindex,
param->paramid,
param->paramtype,
......
......@@ -16,8 +16,7 @@
#include "nodes/plannodes.h"
#include "nodes/relation.h"
extern Node *convert_testexpr(PlannerInfo *root, Node *testexpr, int rtindex, List **righthandIds,
List *sub_tlist);
extern Node *convert_testexpr(PlannerInfo *root, Node *testexpr, int rtindex, List **righthandIds);
extern Node *SS_replace_correlation_vars(PlannerInfo *root, Node *expr);
extern Node *SS_process_sublinks(PlannerInfo *root, Node *expr, bool isQual);
extern void SS_finalize_plan(PlannerInfo *root, List *rtable, Plan *plan,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册