|
|
|
@ -111,8 +111,7 @@ exprType(const Node *expr) |
|
|
|
|
|
|
|
|
|
if (!qtree || !IsA(qtree, Query)) |
|
|
|
|
elog(ERROR, "cannot get type for untransformed sublink"); |
|
|
|
|
tent = (TargetEntry *) linitial(qtree->targetList); |
|
|
|
|
Assert(IsA(tent, TargetEntry)); |
|
|
|
|
tent = castNode(TargetEntry, linitial(qtree->targetList)); |
|
|
|
|
Assert(!tent->resjunk); |
|
|
|
|
type = exprType((Node *) tent->expr); |
|
|
|
|
if (sublink->subLinkType == ARRAY_SUBLINK) |
|
|
|
@ -322,8 +321,7 @@ exprTypmod(const Node *expr) |
|
|
|
|
|
|
|
|
|
if (!qtree || !IsA(qtree, Query)) |
|
|
|
|
elog(ERROR, "cannot get type for untransformed sublink"); |
|
|
|
|
tent = (TargetEntry *) linitial(qtree->targetList); |
|
|
|
|
Assert(IsA(tent, TargetEntry)); |
|
|
|
|
tent = castNode(TargetEntry, linitial(qtree->targetList)); |
|
|
|
|
Assert(!tent->resjunk); |
|
|
|
|
return exprTypmod((Node *) tent->expr); |
|
|
|
|
/* note we don't need to care if it's an array */ |
|
|
|
@ -381,9 +379,8 @@ exprTypmod(const Node *expr) |
|
|
|
|
return -1; /* no point in trying harder */ |
|
|
|
|
foreach(arg, cexpr->args) |
|
|
|
|
{ |
|
|
|
|
CaseWhen *w = (CaseWhen *) lfirst(arg); |
|
|
|
|
CaseWhen *w = castNode(CaseWhen, lfirst(arg)); |
|
|
|
|
|
|
|
|
|
Assert(IsA(w, CaseWhen)); |
|
|
|
|
if (exprType((Node *) w->result) != casetype) |
|
|
|
|
return -1; |
|
|
|
|
if (exprTypmod((Node *) w->result) != typmod) |
|
|
|
@ -809,8 +806,7 @@ exprCollation(const Node *expr) |
|
|
|
|
|
|
|
|
|
if (!qtree || !IsA(qtree, Query)) |
|
|
|
|
elog(ERROR, "cannot get collation for untransformed sublink"); |
|
|
|
|
tent = (TargetEntry *) linitial(qtree->targetList); |
|
|
|
|
Assert(IsA(tent, TargetEntry)); |
|
|
|
|
tent = castNode(TargetEntry, linitial(qtree->targetList)); |
|
|
|
|
Assert(!tent->resjunk); |
|
|
|
|
coll = exprCollation((Node *) tent->expr); |
|
|
|
|
/* collation doesn't change if it's converted to array */ |
|
|
|
@ -1052,8 +1048,7 @@ exprSetCollation(Node *expr, Oid collation) |
|
|
|
|
|
|
|
|
|
if (!qtree || !IsA(qtree, Query)) |
|
|
|
|
elog(ERROR, "cannot set collation for untransformed sublink"); |
|
|
|
|
tent = (TargetEntry *) linitial(qtree->targetList); |
|
|
|
|
Assert(IsA(tent, TargetEntry)); |
|
|
|
|
tent = castNode(TargetEntry, linitial(qtree->targetList)); |
|
|
|
|
Assert(!tent->resjunk); |
|
|
|
|
Assert(collation == exprCollation((Node *) tent->expr)); |
|
|
|
|
} |
|
|
|
@ -2050,9 +2045,8 @@ expression_tree_walker(Node *node, |
|
|
|
|
/* we assume walker doesn't care about CaseWhens, either */ |
|
|
|
|
foreach(temp, caseexpr->args) |
|
|
|
|
{ |
|
|
|
|
CaseWhen *when = (CaseWhen *) lfirst(temp); |
|
|
|
|
CaseWhen *when = castNode(CaseWhen, lfirst(temp)); |
|
|
|
|
|
|
|
|
|
Assert(IsA(when, CaseWhen)); |
|
|
|
|
if (walker(when->expr, context)) |
|
|
|
|
return true; |
|
|
|
|
if (walker(when->result, context)) |
|
|
|
@ -3261,9 +3255,8 @@ raw_expression_tree_walker(Node *node, |
|
|
|
|
/* we assume walker doesn't care about CaseWhens, either */ |
|
|
|
|
foreach(temp, caseexpr->args) |
|
|
|
|
{ |
|
|
|
|
CaseWhen *when = (CaseWhen *) lfirst(temp); |
|
|
|
|
CaseWhen *when = castNode(CaseWhen, lfirst(temp)); |
|
|
|
|
|
|
|
|
|
Assert(IsA(when, CaseWhen)); |
|
|
|
|
if (walker(when->expr, context)) |
|
|
|
|
return true; |
|
|
|
|
if (walker(when->result, context)) |
|
|
|
@ -3735,9 +3728,8 @@ planstate_walk_subplans(List *plans, |
|
|
|
|
|
|
|
|
|
foreach(lc, plans) |
|
|
|
|
{ |
|
|
|
|
SubPlanState *sps = (SubPlanState *) lfirst(lc); |
|
|
|
|
SubPlanState *sps = castNode(SubPlanState, lfirst(lc)); |
|
|
|
|
|
|
|
|
|
Assert(IsA(sps, SubPlanState)); |
|
|
|
|
if (walker(sps->planstate, context)) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|