Make more use of castNode()
This commit is contained in:
parent
4e5ce3c1ae
commit
38d103763d
@ -1123,7 +1123,7 @@ ProcessCopyOptions(ParseState *pstate,
|
|||||||
if (defel->arg && IsA(defel->arg, A_Star))
|
if (defel->arg && IsA(defel->arg, A_Star))
|
||||||
cstate->force_quote_all = true;
|
cstate->force_quote_all = true;
|
||||||
else if (defel->arg && IsA(defel->arg, List))
|
else if (defel->arg && IsA(defel->arg, List))
|
||||||
cstate->force_quote = (List *) defel->arg;
|
cstate->force_quote = castNode(List, defel->arg);
|
||||||
else
|
else
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
|
@ -111,8 +111,7 @@ exprType(const Node *expr)
|
|||||||
|
|
||||||
if (!qtree || !IsA(qtree, Query))
|
if (!qtree || !IsA(qtree, Query))
|
||||||
elog(ERROR, "cannot get type for untransformed sublink");
|
elog(ERROR, "cannot get type for untransformed sublink");
|
||||||
tent = (TargetEntry *) linitial(qtree->targetList);
|
tent = castNode(TargetEntry, linitial(qtree->targetList));
|
||||||
Assert(IsA(tent, TargetEntry));
|
|
||||||
Assert(!tent->resjunk);
|
Assert(!tent->resjunk);
|
||||||
type = exprType((Node *) tent->expr);
|
type = exprType((Node *) tent->expr);
|
||||||
if (sublink->subLinkType == ARRAY_SUBLINK)
|
if (sublink->subLinkType == ARRAY_SUBLINK)
|
||||||
@ -322,8 +321,7 @@ exprTypmod(const Node *expr)
|
|||||||
|
|
||||||
if (!qtree || !IsA(qtree, Query))
|
if (!qtree || !IsA(qtree, Query))
|
||||||
elog(ERROR, "cannot get type for untransformed sublink");
|
elog(ERROR, "cannot get type for untransformed sublink");
|
||||||
tent = (TargetEntry *) linitial(qtree->targetList);
|
tent = castNode(TargetEntry, linitial(qtree->targetList));
|
||||||
Assert(IsA(tent, TargetEntry));
|
|
||||||
Assert(!tent->resjunk);
|
Assert(!tent->resjunk);
|
||||||
return exprTypmod((Node *) tent->expr);
|
return exprTypmod((Node *) tent->expr);
|
||||||
/* note we don't need to care if it's an array */
|
/* 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 */
|
return -1; /* no point in trying harder */
|
||||||
foreach(arg, cexpr->args)
|
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)
|
if (exprType((Node *) w->result) != casetype)
|
||||||
return -1;
|
return -1;
|
||||||
if (exprTypmod((Node *) w->result) != typmod)
|
if (exprTypmod((Node *) w->result) != typmod)
|
||||||
@ -809,8 +806,7 @@ exprCollation(const Node *expr)
|
|||||||
|
|
||||||
if (!qtree || !IsA(qtree, Query))
|
if (!qtree || !IsA(qtree, Query))
|
||||||
elog(ERROR, "cannot get collation for untransformed sublink");
|
elog(ERROR, "cannot get collation for untransformed sublink");
|
||||||
tent = (TargetEntry *) linitial(qtree->targetList);
|
tent = castNode(TargetEntry, linitial(qtree->targetList));
|
||||||
Assert(IsA(tent, TargetEntry));
|
|
||||||
Assert(!tent->resjunk);
|
Assert(!tent->resjunk);
|
||||||
coll = exprCollation((Node *) tent->expr);
|
coll = exprCollation((Node *) tent->expr);
|
||||||
/* collation doesn't change if it's converted to array */
|
/* collation doesn't change if it's converted to array */
|
||||||
@ -1052,8 +1048,7 @@ exprSetCollation(Node *expr, Oid collation)
|
|||||||
|
|
||||||
if (!qtree || !IsA(qtree, Query))
|
if (!qtree || !IsA(qtree, Query))
|
||||||
elog(ERROR, "cannot set collation for untransformed sublink");
|
elog(ERROR, "cannot set collation for untransformed sublink");
|
||||||
tent = (TargetEntry *) linitial(qtree->targetList);
|
tent = castNode(TargetEntry, linitial(qtree->targetList));
|
||||||
Assert(IsA(tent, TargetEntry));
|
|
||||||
Assert(!tent->resjunk);
|
Assert(!tent->resjunk);
|
||||||
Assert(collation == exprCollation((Node *) tent->expr));
|
Assert(collation == exprCollation((Node *) tent->expr));
|
||||||
}
|
}
|
||||||
@ -2050,9 +2045,8 @@ expression_tree_walker(Node *node,
|
|||||||
/* we assume walker doesn't care about CaseWhens, either */
|
/* we assume walker doesn't care about CaseWhens, either */
|
||||||
foreach(temp, caseexpr->args)
|
foreach(temp, caseexpr->args)
|
||||||
{
|
{
|
||||||
CaseWhen *when = (CaseWhen *) lfirst(temp);
|
CaseWhen *when = castNode(CaseWhen, lfirst(temp));
|
||||||
|
|
||||||
Assert(IsA(when, CaseWhen));
|
|
||||||
if (walker(when->expr, context))
|
if (walker(when->expr, context))
|
||||||
return true;
|
return true;
|
||||||
if (walker(when->result, context))
|
if (walker(when->result, context))
|
||||||
@ -3261,9 +3255,8 @@ raw_expression_tree_walker(Node *node,
|
|||||||
/* we assume walker doesn't care about CaseWhens, either */
|
/* we assume walker doesn't care about CaseWhens, either */
|
||||||
foreach(temp, caseexpr->args)
|
foreach(temp, caseexpr->args)
|
||||||
{
|
{
|
||||||
CaseWhen *when = (CaseWhen *) lfirst(temp);
|
CaseWhen *when = castNode(CaseWhen, lfirst(temp));
|
||||||
|
|
||||||
Assert(IsA(when, CaseWhen));
|
|
||||||
if (walker(when->expr, context))
|
if (walker(when->expr, context))
|
||||||
return true;
|
return true;
|
||||||
if (walker(when->result, context))
|
if (walker(when->result, context))
|
||||||
@ -3735,9 +3728,8 @@ planstate_walk_subplans(List *plans,
|
|||||||
|
|
||||||
foreach(lc, plans)
|
foreach(lc, plans)
|
||||||
{
|
{
|
||||||
SubPlanState *sps = (SubPlanState *) lfirst(lc);
|
SubPlanState *sps = castNode(SubPlanState, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(sps, SubPlanState));
|
|
||||||
if (walker(sps->planstate, context))
|
if (walker(sps->planstate, context))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2382,8 +2382,8 @@ subquery_is_pushdown_safe(Query *subquery, Query *topquery,
|
|||||||
if (subquery->setOperations != NULL)
|
if (subquery->setOperations != NULL)
|
||||||
return false;
|
return false;
|
||||||
/* Check whether setop component output types match top level */
|
/* Check whether setop component output types match top level */
|
||||||
topop = (SetOperationStmt *) topquery->setOperations;
|
topop = castNode(SetOperationStmt, topquery->setOperations);
|
||||||
Assert(topop && IsA(topop, SetOperationStmt));
|
Assert(topop);
|
||||||
compare_tlist_datatypes(subquery->targetList,
|
compare_tlist_datatypes(subquery->targetList,
|
||||||
topop->colTypes,
|
topop->colTypes,
|
||||||
safetyInfo);
|
safetyInfo);
|
||||||
|
@ -682,9 +682,8 @@ extract_nonindex_conditions(List *qual_clauses, List *indexquals)
|
|||||||
|
|
||||||
foreach(lc, qual_clauses)
|
foreach(lc, qual_clauses)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
if (rinfo->pseudoconstant)
|
if (rinfo->pseudoconstant)
|
||||||
continue; /* we may drop pseudoconstants here */
|
continue; /* we may drop pseudoconstants here */
|
||||||
if (list_member_ptr(indexquals, rinfo))
|
if (list_member_ptr(indexquals, rinfo))
|
||||||
@ -1804,12 +1803,10 @@ cost_windowagg(Path *path, PlannerInfo *root,
|
|||||||
*/
|
*/
|
||||||
foreach(lc, windowFuncs)
|
foreach(lc, windowFuncs)
|
||||||
{
|
{
|
||||||
WindowFunc *wfunc = (WindowFunc *) lfirst(lc);
|
WindowFunc *wfunc = castNode(WindowFunc, lfirst(lc));
|
||||||
Cost wfunccost;
|
Cost wfunccost;
|
||||||
QualCost argcosts;
|
QualCost argcosts;
|
||||||
|
|
||||||
Assert(IsA(wfunc, WindowFunc));
|
|
||||||
|
|
||||||
wfunccost = get_func_cost(wfunc->winfnoid) * cpu_operator_cost;
|
wfunccost = get_func_cost(wfunc->winfnoid) * cpu_operator_cost;
|
||||||
|
|
||||||
/* also add the input expressions' cost to per-input-row costs */
|
/* also add the input expressions' cost to per-input-row costs */
|
||||||
@ -2843,11 +2840,9 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
|
|||||||
innerbucketsize = 1.0;
|
innerbucketsize = 1.0;
|
||||||
foreach(hcl, hashclauses)
|
foreach(hcl, hashclauses)
|
||||||
{
|
{
|
||||||
RestrictInfo *restrictinfo = (RestrictInfo *) lfirst(hcl);
|
RestrictInfo *restrictinfo = castNode(RestrictInfo, lfirst(hcl));
|
||||||
Selectivity thisbucketsize;
|
Selectivity thisbucketsize;
|
||||||
|
|
||||||
Assert(IsA(restrictinfo, RestrictInfo));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First we have to figure out which side of the hashjoin clause
|
* First we have to figure out which side of the hashjoin clause
|
||||||
* is the inner side.
|
* is the inner side.
|
||||||
@ -3537,9 +3532,8 @@ compute_semi_anti_join_factors(PlannerInfo *root,
|
|||||||
joinquals = NIL;
|
joinquals = NIL;
|
||||||
foreach(l, restrictlist)
|
foreach(l, restrictlist)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
if (!rinfo->is_pushed_down)
|
if (!rinfo->is_pushed_down)
|
||||||
joinquals = lappend(joinquals, rinfo);
|
joinquals = lappend(joinquals, rinfo);
|
||||||
}
|
}
|
||||||
@ -3970,9 +3964,8 @@ calc_joinrel_size_estimate(PlannerInfo *root,
|
|||||||
/* Grovel through the clauses to separate into two lists */
|
/* Grovel through the clauses to separate into two lists */
|
||||||
foreach(l, restrictlist)
|
foreach(l, restrictlist)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
if (rinfo->is_pushed_down)
|
if (rinfo->is_pushed_down)
|
||||||
pushedquals = lappend(pushedquals, rinfo);
|
pushedquals = lappend(pushedquals, rinfo);
|
||||||
else
|
else
|
||||||
@ -4345,11 +4338,10 @@ set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
|
|||||||
*/
|
*/
|
||||||
foreach(lc, subroot->parse->targetList)
|
foreach(lc, subroot->parse->targetList)
|
||||||
{
|
{
|
||||||
TargetEntry *te = (TargetEntry *) lfirst(lc);
|
TargetEntry *te = castNode(TargetEntry, lfirst(lc));
|
||||||
Node *texpr = (Node *) te->expr;
|
Node *texpr = (Node *) te->expr;
|
||||||
int32 item_width = 0;
|
int32 item_width = 0;
|
||||||
|
|
||||||
Assert(IsA(te, TargetEntry));
|
|
||||||
/* junk columns aren't visible to upper query */
|
/* junk columns aren't visible to upper query */
|
||||||
if (te->resjunk)
|
if (te->resjunk)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1273,12 +1273,11 @@ generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel,
|
|||||||
|
|
||||||
foreach(lc, clauses)
|
foreach(lc, clauses)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
|
||||||
List *pathlist;
|
List *pathlist;
|
||||||
Path *bitmapqual;
|
Path *bitmapqual;
|
||||||
ListCell *j;
|
ListCell *j;
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
/* Ignore RestrictInfos that aren't ORs */
|
/* Ignore RestrictInfos that aren't ORs */
|
||||||
if (!restriction_is_or_clause(rinfo))
|
if (!restriction_is_or_clause(rinfo))
|
||||||
continue;
|
continue;
|
||||||
@ -1310,10 +1309,10 @@ generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RestrictInfo *rinfo = castNode(RestrictInfo, orarg);
|
||||||
List *orargs;
|
List *orargs;
|
||||||
|
|
||||||
Assert(IsA(orarg, RestrictInfo));
|
Assert(!restriction_is_or_clause(rinfo));
|
||||||
Assert(!restriction_is_or_clause((RestrictInfo *) orarg));
|
|
||||||
orargs = list_make1(orarg);
|
orargs = list_make1(orarg);
|
||||||
|
|
||||||
indlist = build_paths_for_OR(root, rel,
|
indlist = build_paths_for_OR(root, rel,
|
||||||
@ -2174,9 +2173,8 @@ match_clauses_to_index(IndexOptInfo *index,
|
|||||||
|
|
||||||
foreach(lc, clauses)
|
foreach(lc, clauses)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
match_clause_to_index(index, rinfo, clauseset);
|
match_clause_to_index(index, rinfo, clauseset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1230,9 +1230,8 @@ restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
|
|||||||
*/
|
*/
|
||||||
foreach(lc, restrictlist)
|
foreach(lc, restrictlist)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
if (only_pushed_down && !rinfo->is_pushed_down)
|
if (only_pushed_down && !rinfo->is_pushed_down)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ rel_is_distinct_for(PlannerInfo *root, RelOptInfo *rel, List *clause_list)
|
|||||||
*/
|
*/
|
||||||
foreach(l, clause_list)
|
foreach(l, clause_list)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||||
Oid op;
|
Oid op;
|
||||||
Var *var;
|
Var *var;
|
||||||
|
|
||||||
@ -608,8 +608,7 @@ rel_is_distinct_for(PlannerInfo *root, RelOptInfo *rel, List *clause_list)
|
|||||||
* caller's mergejoinability test should have selected only
|
* caller's mergejoinability test should have selected only
|
||||||
* OpExprs.
|
* OpExprs.
|
||||||
*/
|
*/
|
||||||
Assert(IsA(rinfo->clause, OpExpr));
|
op = castNode(OpExpr, rinfo->clause)->opno;
|
||||||
op = ((OpExpr *) rinfo->clause)->opno;
|
|
||||||
|
|
||||||
/* caller identified the inner side for us */
|
/* caller identified the inner side for us */
|
||||||
if (rinfo->outer_is_left)
|
if (rinfo->outer_is_left)
|
||||||
@ -782,9 +781,8 @@ query_is_distinct_for(Query *query, List *colnos, List *opids)
|
|||||||
*/
|
*/
|
||||||
if (query->setOperations)
|
if (query->setOperations)
|
||||||
{
|
{
|
||||||
SetOperationStmt *topop = (SetOperationStmt *) query->setOperations;
|
SetOperationStmt *topop = castNode(SetOperationStmt, query->setOperations);
|
||||||
|
|
||||||
Assert(IsA(topop, SetOperationStmt));
|
|
||||||
Assert(topop->op != SETOP_NONE);
|
Assert(topop->op != SETOP_NONE);
|
||||||
|
|
||||||
if (!topop->all)
|
if (!topop->all)
|
||||||
|
@ -508,8 +508,7 @@ create_scan_plan(PlannerInfo *root, Path *best_path, int flags)
|
|||||||
{
|
{
|
||||||
case T_IndexScan:
|
case T_IndexScan:
|
||||||
case T_IndexOnlyScan:
|
case T_IndexOnlyScan:
|
||||||
Assert(IsA(best_path, IndexPath));
|
scan_clauses = castNode(IndexPath, best_path)->indexinfo->indrestrictinfo;
|
||||||
scan_clauses = ((IndexPath *) best_path)->indexinfo->indrestrictinfo;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
scan_clauses = rel->baserestrictinfo;
|
scan_clauses = rel->baserestrictinfo;
|
||||||
@ -2450,9 +2449,8 @@ create_indexscan_plan(PlannerInfo *root,
|
|||||||
qpqual = NIL;
|
qpqual = NIL;
|
||||||
foreach(l, scan_clauses)
|
foreach(l, scan_clauses)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
if (rinfo->pseudoconstant)
|
if (rinfo->pseudoconstant)
|
||||||
continue; /* we may drop pseudoconstants here */
|
continue; /* we may drop pseudoconstants here */
|
||||||
if (list_member_ptr(indexquals, rinfo))
|
if (list_member_ptr(indexquals, rinfo))
|
||||||
@ -2608,10 +2606,9 @@ create_bitmap_scan_plan(PlannerInfo *root,
|
|||||||
qpqual = NIL;
|
qpqual = NIL;
|
||||||
foreach(l, scan_clauses)
|
foreach(l, scan_clauses)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||||
Node *clause = (Node *) rinfo->clause;
|
Node *clause = (Node *) rinfo->clause;
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
if (rinfo->pseudoconstant)
|
if (rinfo->pseudoconstant)
|
||||||
continue; /* we may drop pseudoconstants here */
|
continue; /* we may drop pseudoconstants here */
|
||||||
if (list_member(indexquals, clause))
|
if (list_member(indexquals, clause))
|
||||||
@ -2820,9 +2817,9 @@ create_bitmap_subplan(PlannerInfo *root, Path *bitmapqual,
|
|||||||
ListCell *l;
|
ListCell *l;
|
||||||
|
|
||||||
/* Use the regular indexscan plan build machinery... */
|
/* Use the regular indexscan plan build machinery... */
|
||||||
iscan = (IndexScan *) create_indexscan_plan(root, ipath,
|
iscan = castNode(IndexScan,
|
||||||
NIL, NIL, false);
|
create_indexscan_plan(root, ipath,
|
||||||
Assert(IsA(iscan, IndexScan));
|
NIL, NIL, false));
|
||||||
/* then convert to a bitmap indexscan */
|
/* then convert to a bitmap indexscan */
|
||||||
plan = (Plan *) make_bitmap_indexscan(iscan->scan.scanrelid,
|
plan = (Plan *) make_bitmap_indexscan(iscan->scan.scanrelid,
|
||||||
iscan->indexid,
|
iscan->indexid,
|
||||||
@ -3391,13 +3388,13 @@ create_customscan_plan(PlannerInfo *root, CustomPath *best_path,
|
|||||||
* Invoke custom plan provider to create the Plan node represented by the
|
* Invoke custom plan provider to create the Plan node represented by the
|
||||||
* CustomPath.
|
* CustomPath.
|
||||||
*/
|
*/
|
||||||
cplan = (CustomScan *) best_path->methods->PlanCustomPath(root,
|
cplan = castNode(CustomScan,
|
||||||
rel,
|
best_path->methods->PlanCustomPath(root,
|
||||||
best_path,
|
rel,
|
||||||
tlist,
|
best_path,
|
||||||
scan_clauses,
|
tlist,
|
||||||
custom_plans);
|
scan_clauses,
|
||||||
Assert(IsA(cplan, CustomScan));
|
custom_plans));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy cost data from Path to Plan; no need to make custom-plan providers
|
* Copy cost data from Path to Plan; no need to make custom-plan providers
|
||||||
@ -3683,7 +3680,7 @@ create_mergejoin_plan(PlannerInfo *root,
|
|||||||
i = 0;
|
i = 0;
|
||||||
foreach(lc, best_path->path_mergeclauses)
|
foreach(lc, best_path->path_mergeclauses)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
|
||||||
EquivalenceClass *oeclass;
|
EquivalenceClass *oeclass;
|
||||||
EquivalenceClass *ieclass;
|
EquivalenceClass *ieclass;
|
||||||
PathKey *opathkey;
|
PathKey *opathkey;
|
||||||
@ -3693,7 +3690,6 @@ create_mergejoin_plan(PlannerInfo *root,
|
|||||||
ListCell *l2;
|
ListCell *l2;
|
||||||
|
|
||||||
/* fetch outer/inner eclass from mergeclause */
|
/* fetch outer/inner eclass from mergeclause */
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
if (rinfo->outer_is_left)
|
if (rinfo->outer_is_left)
|
||||||
{
|
{
|
||||||
oeclass = rinfo->left_ec;
|
oeclass = rinfo->left_ec;
|
||||||
@ -4228,12 +4224,10 @@ fix_indexqual_references(PlannerInfo *root, IndexPath *index_path)
|
|||||||
|
|
||||||
forboth(lcc, index_path->indexquals, lci, index_path->indexqualcols)
|
forboth(lcc, index_path->indexquals, lci, index_path->indexqualcols)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lcc);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lcc));
|
||||||
int indexcol = lfirst_int(lci);
|
int indexcol = lfirst_int(lci);
|
||||||
Node *clause;
|
Node *clause;
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace any outer-relation variables with nestloop params.
|
* Replace any outer-relation variables with nestloop params.
|
||||||
*
|
*
|
||||||
|
@ -3963,9 +3963,8 @@ create_one_window_path(PlannerInfo *root,
|
|||||||
window_target = copy_pathtarget(window_target);
|
window_target = copy_pathtarget(window_target);
|
||||||
foreach(lc2, wflists->windowFuncs[wc->winref])
|
foreach(lc2, wflists->windowFuncs[wc->winref])
|
||||||
{
|
{
|
||||||
WindowFunc *wfunc = (WindowFunc *) lfirst(lc2);
|
WindowFunc *wfunc = castNode(WindowFunc, lfirst(lc2));
|
||||||
|
|
||||||
Assert(IsA(wfunc, WindowFunc));
|
|
||||||
add_column_to_pathtarget(window_target, (Expr *) wfunc, 0);
|
add_column_to_pathtarget(window_target, (Expr *) wfunc, 0);
|
||||||
window_target->width += get_typavgwidth(wfunc->wintype, -1);
|
window_target->width += get_typavgwidth(wfunc->wintype, -1);
|
||||||
}
|
}
|
||||||
|
@ -224,11 +224,9 @@ set_plan_references(PlannerInfo *root, Plan *plan)
|
|||||||
*/
|
*/
|
||||||
foreach(lc, root->rowMarks)
|
foreach(lc, root->rowMarks)
|
||||||
{
|
{
|
||||||
PlanRowMark *rc = (PlanRowMark *) lfirst(lc);
|
PlanRowMark *rc = castNode(PlanRowMark, lfirst(lc));
|
||||||
PlanRowMark *newrc;
|
PlanRowMark *newrc;
|
||||||
|
|
||||||
Assert(IsA(rc, PlanRowMark));
|
|
||||||
|
|
||||||
/* flat copy is enough since all fields are scalars */
|
/* flat copy is enough since all fields are scalars */
|
||||||
newrc = (PlanRowMark *) palloc(sizeof(PlanRowMark));
|
newrc = (PlanRowMark *) palloc(sizeof(PlanRowMark));
|
||||||
memcpy(newrc, rc, sizeof(PlanRowMark));
|
memcpy(newrc, rc, sizeof(PlanRowMark));
|
||||||
|
@ -433,9 +433,8 @@ get_first_col_type(Plan *plan, Oid *coltype, int32 *coltypmod,
|
|||||||
/* In cases such as EXISTS, tlist might be empty; arbitrarily use VOID */
|
/* In cases such as EXISTS, tlist might be empty; arbitrarily use VOID */
|
||||||
if (plan->targetlist)
|
if (plan->targetlist)
|
||||||
{
|
{
|
||||||
TargetEntry *tent = (TargetEntry *) linitial(plan->targetlist);
|
TargetEntry *tent = castNode(TargetEntry, linitial(plan->targetlist));
|
||||||
|
|
||||||
Assert(IsA(tent, TargetEntry));
|
|
||||||
if (!tent->resjunk)
|
if (!tent->resjunk)
|
||||||
{
|
{
|
||||||
*coltype = exprType((Node *) tent->expr);
|
*coltype = exprType((Node *) tent->expr);
|
||||||
@ -601,14 +600,14 @@ make_subplan(PlannerInfo *root, Query *orig_subquery,
|
|||||||
AlternativeSubPlan *asplan;
|
AlternativeSubPlan *asplan;
|
||||||
|
|
||||||
/* OK, convert to SubPlan format. */
|
/* OK, convert to SubPlan format. */
|
||||||
hashplan = (SubPlan *) build_subplan(root, plan, subroot,
|
hashplan = castNode(SubPlan,
|
||||||
plan_params,
|
build_subplan(root, plan, subroot,
|
||||||
ANY_SUBLINK, 0,
|
plan_params,
|
||||||
newtestexpr,
|
ANY_SUBLINK, 0,
|
||||||
false, true,
|
newtestexpr,
|
||||||
best_path->parallel_safe);
|
false, true,
|
||||||
|
best_path->parallel_safe));
|
||||||
/* Check we got what we expected */
|
/* Check we got what we expected */
|
||||||
Assert(IsA(hashplan, SubPlan));
|
|
||||||
Assert(hashplan->parParam == NIL);
|
Assert(hashplan->parParam == NIL);
|
||||||
Assert(hashplan->useHashTable);
|
Assert(hashplan->useHashTable);
|
||||||
/* build_subplan won't have filled in paramIds */
|
/* build_subplan won't have filled in paramIds */
|
||||||
|
@ -1748,10 +1748,9 @@ is_simple_union_all(Query *subquery)
|
|||||||
elog(ERROR, "subquery is bogus");
|
elog(ERROR, "subquery is bogus");
|
||||||
|
|
||||||
/* Is it a set-operation query at all? */
|
/* Is it a set-operation query at all? */
|
||||||
topop = (SetOperationStmt *) subquery->setOperations;
|
topop = castNode(SetOperationStmt, subquery->setOperations);
|
||||||
if (!topop)
|
if (!topop)
|
||||||
return false;
|
return false;
|
||||||
Assert(IsA(topop, SetOperationStmt));
|
|
||||||
|
|
||||||
/* Can't handle ORDER BY, LIMIT/OFFSET, locking, or WITH */
|
/* Can't handle ORDER BY, LIMIT/OFFSET, locking, or WITH */
|
||||||
if (subquery->sortClause ||
|
if (subquery->sortClause ||
|
||||||
@ -2323,8 +2322,8 @@ flatten_simple_union_all(PlannerInfo *root)
|
|||||||
RangeTblRef *rtr;
|
RangeTblRef *rtr;
|
||||||
|
|
||||||
/* Shouldn't be called unless query has setops */
|
/* Shouldn't be called unless query has setops */
|
||||||
topop = (SetOperationStmt *) parse->setOperations;
|
topop = castNode(SetOperationStmt, parse->setOperations);
|
||||||
Assert(topop && IsA(topop, SetOperationStmt));
|
Assert(topop);
|
||||||
|
|
||||||
/* Can't optimize away a recursive UNION */
|
/* Can't optimize away a recursive UNION */
|
||||||
if (root->hasRecursion)
|
if (root->hasRecursion)
|
||||||
|
@ -129,7 +129,7 @@ RelOptInfo *
|
|||||||
plan_set_operations(PlannerInfo *root)
|
plan_set_operations(PlannerInfo *root)
|
||||||
{
|
{
|
||||||
Query *parse = root->parse;
|
Query *parse = root->parse;
|
||||||
SetOperationStmt *topop = (SetOperationStmt *) parse->setOperations;
|
SetOperationStmt *topop = castNode(SetOperationStmt, parse->setOperations);
|
||||||
Node *node;
|
Node *node;
|
||||||
RangeTblEntry *leftmostRTE;
|
RangeTblEntry *leftmostRTE;
|
||||||
Query *leftmostQuery;
|
Query *leftmostQuery;
|
||||||
@ -137,7 +137,7 @@ plan_set_operations(PlannerInfo *root)
|
|||||||
Path *path;
|
Path *path;
|
||||||
List *top_tlist;
|
List *top_tlist;
|
||||||
|
|
||||||
Assert(topop && IsA(topop, SetOperationStmt));
|
Assert(topop);
|
||||||
|
|
||||||
/* check for unsupported stuff */
|
/* check for unsupported stuff */
|
||||||
Assert(parse->jointree->fromlist == NIL);
|
Assert(parse->jointree->fromlist == NIL);
|
||||||
@ -1701,12 +1701,11 @@ translate_col_privs(const Bitmapset *parent_privs,
|
|||||||
attno = InvalidAttrNumber;
|
attno = InvalidAttrNumber;
|
||||||
foreach(lc, translated_vars)
|
foreach(lc, translated_vars)
|
||||||
{
|
{
|
||||||
Var *var = (Var *) lfirst(lc);
|
Var *var = castNode(Var, lfirst(lc));
|
||||||
|
|
||||||
attno++;
|
attno++;
|
||||||
if (var == NULL) /* ignore dropped columns */
|
if (var == NULL) /* ignore dropped columns */
|
||||||
continue;
|
continue;
|
||||||
Assert(IsA(var, Var));
|
|
||||||
if (whole_row ||
|
if (whole_row ||
|
||||||
bms_is_member(attno - FirstLowInvalidHeapAttributeNumber,
|
bms_is_member(attno - FirstLowInvalidHeapAttributeNumber,
|
||||||
parent_privs))
|
parent_privs))
|
||||||
|
@ -2700,9 +2700,8 @@ eval_const_expressions_mutator(Node *node,
|
|||||||
* Since the underlying operator is "=", must negate
|
* Since the underlying operator is "=", must negate
|
||||||
* its result
|
* its result
|
||||||
*/
|
*/
|
||||||
Const *csimple = (Const *) simple;
|
Const *csimple = castNode(Const, simple);
|
||||||
|
|
||||||
Assert(IsA(csimple, Const));
|
|
||||||
csimple->constvalue =
|
csimple->constvalue =
|
||||||
BoolGetDatum(!DatumGetBool(csimple->constvalue));
|
BoolGetDatum(!DatumGetBool(csimple->constvalue));
|
||||||
return (Node *) csimple;
|
return (Node *) csimple;
|
||||||
@ -3091,12 +3090,10 @@ eval_const_expressions_mutator(Node *node,
|
|||||||
const_true_cond = false;
|
const_true_cond = false;
|
||||||
foreach(arg, caseexpr->args)
|
foreach(arg, caseexpr->args)
|
||||||
{
|
{
|
||||||
CaseWhen *oldcasewhen = (CaseWhen *) lfirst(arg);
|
CaseWhen *oldcasewhen = castNode(CaseWhen, lfirst(arg));
|
||||||
Node *casecond;
|
Node *casecond;
|
||||||
Node *caseresult;
|
Node *caseresult;
|
||||||
|
|
||||||
Assert(IsA(oldcasewhen, CaseWhen));
|
|
||||||
|
|
||||||
/* Simplify this alternative's test condition */
|
/* Simplify this alternative's test condition */
|
||||||
casecond = eval_const_expressions_mutator((Node *) oldcasewhen->expr,
|
casecond = eval_const_expressions_mutator((Node *) oldcasewhen->expr,
|
||||||
context);
|
context);
|
||||||
@ -4081,8 +4078,7 @@ fetch_function_defaults(HeapTuple func_tuple)
|
|||||||
if (isnull)
|
if (isnull)
|
||||||
elog(ERROR, "not enough default arguments");
|
elog(ERROR, "not enough default arguments");
|
||||||
str = TextDatumGetCString(proargdefaults);
|
str = TextDatumGetCString(proargdefaults);
|
||||||
defaults = (List *) stringToNode(str);
|
defaults = castNode(List, stringToNode(str));
|
||||||
Assert(IsA(defaults, List));
|
|
||||||
pfree(str);
|
pfree(str);
|
||||||
return defaults;
|
return defaults;
|
||||||
}
|
}
|
||||||
|
@ -188,9 +188,8 @@ extract_or_clause(RestrictInfo *or_rinfo, RelOptInfo *rel)
|
|||||||
|
|
||||||
foreach(lc2, andargs)
|
foreach(lc2, andargs)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc2);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc2));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
if (restriction_is_or_clause(rinfo))
|
if (restriction_is_or_clause(rinfo))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -211,11 +210,11 @@ extract_or_clause(RestrictInfo *or_rinfo, RelOptInfo *rel)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Assert(IsA(orarg, RestrictInfo));
|
RestrictInfo *rinfo = castNode(RestrictInfo, orarg);
|
||||||
Assert(!restriction_is_or_clause((RestrictInfo *) orarg));
|
|
||||||
if (is_safe_restriction_clause_for((RestrictInfo *) orarg, rel))
|
Assert(!restriction_is_or_clause(rinfo));
|
||||||
subclauses = lappend(subclauses,
|
if (is_safe_restriction_clause_for(rinfo, rel))
|
||||||
((RestrictInfo *) orarg)->clause);
|
subclauses = lappend(subclauses, rinfo->clause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -335,9 +335,7 @@ get_actual_clauses(List *restrictinfo_list)
|
|||||||
|
|
||||||
foreach(l, restrictinfo_list)
|
foreach(l, restrictinfo_list)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
|
|
||||||
Assert(!rinfo->pseudoconstant);
|
Assert(!rinfo->pseudoconstant);
|
||||||
|
|
||||||
@ -361,9 +359,7 @@ extract_actual_clauses(List *restrictinfo_list,
|
|||||||
|
|
||||||
foreach(l, restrictinfo_list)
|
foreach(l, restrictinfo_list)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
|
|
||||||
if (rinfo->pseudoconstant == pseudoconstant)
|
if (rinfo->pseudoconstant == pseudoconstant)
|
||||||
result = lappend(result, rinfo->clause);
|
result = lappend(result, rinfo->clause);
|
||||||
@ -393,9 +389,7 @@ extract_actual_join_clauses(List *restrictinfo_list,
|
|||||||
|
|
||||||
foreach(l, restrictinfo_list)
|
foreach(l, restrictinfo_list)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
|
|
||||||
if (rinfo->is_pushed_down)
|
if (rinfo->is_pushed_down)
|
||||||
{
|
{
|
||||||
|
@ -824,8 +824,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
|
|||||||
AttrNumber attr_num;
|
AttrNumber attr_num;
|
||||||
TargetEntry *tle;
|
TargetEntry *tle;
|
||||||
|
|
||||||
col = (ResTarget *) lfirst(icols);
|
col = castNode(ResTarget, lfirst(icols));
|
||||||
Assert(IsA(col, ResTarget));
|
|
||||||
attr_num = (AttrNumber) lfirst_int(attnos);
|
attr_num = (AttrNumber) lfirst_int(attnos);
|
||||||
|
|
||||||
tle = makeTargetEntry(expr,
|
tle = makeTargetEntry(expr,
|
||||||
@ -950,8 +949,7 @@ transformInsertRow(ParseState *pstate, List *exprlist,
|
|||||||
Expr *expr = (Expr *) lfirst(lc);
|
Expr *expr = (Expr *) lfirst(lc);
|
||||||
ResTarget *col;
|
ResTarget *col;
|
||||||
|
|
||||||
col = (ResTarget *) lfirst(icols);
|
col = castNode(ResTarget, lfirst(icols));
|
||||||
Assert(IsA(col, ResTarget));
|
|
||||||
|
|
||||||
expr = transformAssignedExpr(pstate, expr,
|
expr = transformAssignedExpr(pstate, expr,
|
||||||
EXPR_KIND_INSERT_TARGET,
|
EXPR_KIND_INSERT_TARGET,
|
||||||
@ -1633,10 +1631,9 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
|
|||||||
/*
|
/*
|
||||||
* Recursively transform the components of the tree.
|
* Recursively transform the components of the tree.
|
||||||
*/
|
*/
|
||||||
sostmt = (SetOperationStmt *) transformSetOperationTree(pstate, stmt,
|
sostmt = castNode(SetOperationStmt,
|
||||||
true,
|
transformSetOperationTree(pstate, stmt, true, NULL));
|
||||||
NULL);
|
Assert(sostmt);
|
||||||
Assert(sostmt && IsA(sostmt, SetOperationStmt));
|
|
||||||
qry->setOperations = (Node *) sostmt;
|
qry->setOperations = (Node *) sostmt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2298,8 +2295,7 @@ transformUpdateTargetList(ParseState *pstate, List *origTlist)
|
|||||||
}
|
}
|
||||||
if (orig_tl == NULL)
|
if (orig_tl == NULL)
|
||||||
elog(ERROR, "UPDATE target count mismatch --- internal error");
|
elog(ERROR, "UPDATE target count mismatch --- internal error");
|
||||||
origTarget = (ResTarget *) lfirst(orig_tl);
|
origTarget = castNode(ResTarget, lfirst(orig_tl));
|
||||||
Assert(IsA(origTarget, ResTarget));
|
|
||||||
|
|
||||||
attrno = attnameAttNum(pstate->p_target_relation,
|
attrno = attnameAttNum(pstate->p_target_relation,
|
||||||
origTarget->name, true);
|
origTarget->name, true);
|
||||||
|
@ -3249,8 +3249,7 @@ ColQualList:
|
|||||||
ColConstraint:
|
ColConstraint:
|
||||||
CONSTRAINT name ColConstraintElem
|
CONSTRAINT name ColConstraintElem
|
||||||
{
|
{
|
||||||
Constraint *n = (Constraint *) $3;
|
Constraint *n = castNode(Constraint, $3);
|
||||||
Assert(IsA(n, Constraint));
|
|
||||||
n->conname = $2;
|
n->conname = $2;
|
||||||
n->location = @1;
|
n->location = @1;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
@ -3442,8 +3441,7 @@ TableLikeOption:
|
|||||||
TableConstraint:
|
TableConstraint:
|
||||||
CONSTRAINT name ConstraintElem
|
CONSTRAINT name ConstraintElem
|
||||||
{
|
{
|
||||||
Constraint *n = (Constraint *) $3;
|
Constraint *n = castNode(Constraint, $3);
|
||||||
Assert(IsA(n, Constraint));
|
|
||||||
n->conname = $2;
|
n->conname = $2;
|
||||||
n->location = @1;
|
n->location = @1;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
@ -12845,8 +12843,7 @@ c_expr: columnref { $$ = $1; }
|
|||||||
}
|
}
|
||||||
| ARRAY array_expr
|
| ARRAY array_expr
|
||||||
{
|
{
|
||||||
A_ArrayExpr *n = (A_ArrayExpr *) $2;
|
A_ArrayExpr *n = castNode(A_ArrayExpr, $2);
|
||||||
Assert(IsA(n, A_ArrayExpr));
|
|
||||||
/* point outermost A_ArrayExpr to the ARRAY keyword */
|
/* point outermost A_ArrayExpr to the ARRAY keyword */
|
||||||
n->location = @1;
|
n->location = @1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -903,8 +903,7 @@ transformFromClauseItem(ParseState *pstate, Node *n,
|
|||||||
rel = transformFromClauseItem(pstate, rts->relation,
|
rel = transformFromClauseItem(pstate, rts->relation,
|
||||||
top_rte, top_rti, namespace);
|
top_rte, top_rti, namespace);
|
||||||
/* Currently, grammar could only return a RangeVar as contained rel */
|
/* Currently, grammar could only return a RangeVar as contained rel */
|
||||||
Assert(IsA(rel, RangeTblRef));
|
rtr = castNode(RangeTblRef, rel);
|
||||||
rtr = (RangeTblRef *) rel;
|
|
||||||
rte = rt_fetch(rtr->rtindex, pstate->p_rtable);
|
rte = rt_fetch(rtr->rtindex, pstate->p_rtable);
|
||||||
/* We only support this on plain relations and matviews */
|
/* We only support this on plain relations and matviews */
|
||||||
if (rte->relkind != RELKIND_RELATION &&
|
if (rte->relkind != RELKIND_RELATION &&
|
||||||
|
@ -514,8 +514,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
|
|||||||
|
|
||||||
if (qtree->targetList == NIL)
|
if (qtree->targetList == NIL)
|
||||||
return false;
|
return false;
|
||||||
tent = (TargetEntry *) linitial(qtree->targetList);
|
tent = castNode(TargetEntry, linitial(qtree->targetList));
|
||||||
Assert(IsA(tent, TargetEntry));
|
|
||||||
if (tent->resjunk)
|
if (tent->resjunk)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -650,9 +649,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
|
|||||||
|
|
||||||
foreach(lc, expr->args)
|
foreach(lc, expr->args)
|
||||||
{
|
{
|
||||||
CaseWhen *when = (CaseWhen *) lfirst(lc);
|
CaseWhen *when = castNode(CaseWhen, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(when, CaseWhen));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The condition expressions mustn't affect
|
* The condition expressions mustn't affect
|
||||||
@ -868,9 +865,8 @@ assign_aggregate_collations(Aggref *aggref,
|
|||||||
/* Process aggregated args, holding resjunk ones at arm's length */
|
/* Process aggregated args, holding resjunk ones at arm's length */
|
||||||
foreach(lc, aggref->args)
|
foreach(lc, aggref->args)
|
||||||
{
|
{
|
||||||
TargetEntry *tle = (TargetEntry *) lfirst(lc);
|
TargetEntry *tle = castNode(TargetEntry, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(tle, TargetEntry));
|
|
||||||
if (tle->resjunk)
|
if (tle->resjunk)
|
||||||
assign_expr_collations(loccontext->pstate, (Node *) tle);
|
assign_expr_collations(loccontext->pstate, (Node *) tle);
|
||||||
else
|
else
|
||||||
@ -913,9 +909,8 @@ assign_ordered_set_collations(Aggref *aggref,
|
|||||||
/* Process aggregated args appropriately */
|
/* Process aggregated args appropriately */
|
||||||
foreach(lc, aggref->args)
|
foreach(lc, aggref->args)
|
||||||
{
|
{
|
||||||
TargetEntry *tle = (TargetEntry *) lfirst(lc);
|
TargetEntry *tle = castNode(TargetEntry, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(tle, TargetEntry));
|
|
||||||
if (merge_sort_collations)
|
if (merge_sort_collations)
|
||||||
(void) assign_collations_walker((Node *) tle, loccontext);
|
(void) assign_collations_walker((Node *) tle, loccontext);
|
||||||
else
|
else
|
||||||
|
@ -917,13 +917,11 @@ transformAExprOp(ParseState *pstate, A_Expr *a)
|
|||||||
/* ROW() op ROW() is handled specially */
|
/* ROW() op ROW() is handled specially */
|
||||||
lexpr = transformExprRecurse(pstate, lexpr);
|
lexpr = transformExprRecurse(pstate, lexpr);
|
||||||
rexpr = transformExprRecurse(pstate, rexpr);
|
rexpr = transformExprRecurse(pstate, rexpr);
|
||||||
Assert(IsA(lexpr, RowExpr));
|
|
||||||
Assert(IsA(rexpr, RowExpr));
|
|
||||||
|
|
||||||
result = make_row_comparison_op(pstate,
|
result = make_row_comparison_op(pstate,
|
||||||
a->name,
|
a->name,
|
||||||
((RowExpr *) lexpr)->args,
|
castNode(RowExpr, lexpr)->args,
|
||||||
((RowExpr *) rexpr)->args,
|
castNode(RowExpr, rexpr)->args,
|
||||||
a->location);
|
a->location);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1296,8 +1294,7 @@ transformAExprBetween(ParseState *pstate, A_Expr *a)
|
|||||||
|
|
||||||
/* Deconstruct A_Expr into three subexprs */
|
/* Deconstruct A_Expr into three subexprs */
|
||||||
aexpr = a->lexpr;
|
aexpr = a->lexpr;
|
||||||
Assert(IsA(a->rexpr, List));
|
args = castNode(List, a->rexpr);
|
||||||
args = (List *) a->rexpr;
|
|
||||||
Assert(list_length(args) == 2);
|
Assert(list_length(args) == 2);
|
||||||
bexpr = (Node *) linitial(args);
|
bexpr = (Node *) linitial(args);
|
||||||
cexpr = (Node *) lsecond(args);
|
cexpr = (Node *) lsecond(args);
|
||||||
@ -1672,12 +1669,10 @@ transformCaseExpr(ParseState *pstate, CaseExpr *c)
|
|||||||
resultexprs = NIL;
|
resultexprs = NIL;
|
||||||
foreach(l, c->args)
|
foreach(l, c->args)
|
||||||
{
|
{
|
||||||
CaseWhen *w = (CaseWhen *) lfirst(l);
|
CaseWhen *w = castNode(CaseWhen, lfirst(l));
|
||||||
CaseWhen *neww = makeNode(CaseWhen);
|
CaseWhen *neww = makeNode(CaseWhen);
|
||||||
Node *warg;
|
Node *warg;
|
||||||
|
|
||||||
Assert(IsA(w, CaseWhen));
|
|
||||||
|
|
||||||
warg = (Node *) w->expr;
|
warg = (Node *) w->expr;
|
||||||
if (placeholder)
|
if (placeholder)
|
||||||
{
|
{
|
||||||
@ -2339,12 +2334,10 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
|
|||||||
|
|
||||||
foreach(lc, x->named_args)
|
foreach(lc, x->named_args)
|
||||||
{
|
{
|
||||||
ResTarget *r = (ResTarget *) lfirst(lc);
|
ResTarget *r = castNode(ResTarget, lfirst(lc));
|
||||||
Node *expr;
|
Node *expr;
|
||||||
char *argname;
|
char *argname;
|
||||||
|
|
||||||
Assert(IsA(r, ResTarget));
|
|
||||||
|
|
||||||
expr = transformExprRecurse(pstate, r->val);
|
expr = transformExprRecurse(pstate, r->val);
|
||||||
|
|
||||||
if (r->name)
|
if (r->name)
|
||||||
@ -2800,8 +2793,7 @@ make_row_comparison_op(ParseState *pstate, List *opname,
|
|||||||
Node *rarg = (Node *) lfirst(r);
|
Node *rarg = (Node *) lfirst(r);
|
||||||
OpExpr *cmp;
|
OpExpr *cmp;
|
||||||
|
|
||||||
cmp = (OpExpr *) make_op(pstate, opname, larg, rarg, location);
|
cmp = castNode(OpExpr, make_op(pstate, opname, larg, rarg, location));
|
||||||
Assert(IsA(cmp, OpExpr));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't use coerce_to_boolean here because we insist on the
|
* We don't use coerce_to_boolean here because we insist on the
|
||||||
|
@ -1515,8 +1515,7 @@ func_get_detail(List *funcname,
|
|||||||
&isnull);
|
&isnull);
|
||||||
Assert(!isnull);
|
Assert(!isnull);
|
||||||
str = TextDatumGetCString(proargdefaults);
|
str = TextDatumGetCString(proargdefaults);
|
||||||
defaults = (List *) stringToNode(str);
|
defaults = castNode(List, stringToNode(str));
|
||||||
Assert(IsA(defaults, List));
|
|
||||||
pfree(str);
|
pfree(str);
|
||||||
|
|
||||||
/* Delete any unused defaults from the returned list */
|
/* Delete any unused defaults from the returned list */
|
||||||
|
@ -335,10 +335,9 @@ transformArraySubscripts(ParseState *pstate,
|
|||||||
*/
|
*/
|
||||||
foreach(idx, indirection)
|
foreach(idx, indirection)
|
||||||
{
|
{
|
||||||
A_Indices *ai = (A_Indices *) lfirst(idx);
|
A_Indices *ai = castNode(A_Indices, lfirst(idx));
|
||||||
Node *subexpr;
|
Node *subexpr;
|
||||||
|
|
||||||
Assert(IsA(ai, A_Indices));
|
|
||||||
if (isSlice)
|
if (isSlice)
|
||||||
{
|
{
|
||||||
if (ai->lidx)
|
if (ai->lidx)
|
||||||
|
@ -910,12 +910,11 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
|
|||||||
JoinExpr *j;
|
JoinExpr *j;
|
||||||
|
|
||||||
if (rtindex > 0 && rtindex <= list_length(pstate->p_joinexprs))
|
if (rtindex > 0 && rtindex <= list_length(pstate->p_joinexprs))
|
||||||
j = (JoinExpr *) list_nth(pstate->p_joinexprs, rtindex - 1);
|
j = castNode(JoinExpr, list_nth(pstate->p_joinexprs, rtindex - 1));
|
||||||
else
|
else
|
||||||
j = NULL;
|
j = NULL;
|
||||||
if (j == NULL)
|
if (j == NULL)
|
||||||
elog(ERROR, "could not find JoinExpr for whole-row reference");
|
elog(ERROR, "could not find JoinExpr for whole-row reference");
|
||||||
Assert(IsA(j, JoinExpr));
|
|
||||||
|
|
||||||
/* Note: we can't see FromExpr here */
|
/* Note: we can't see FromExpr here */
|
||||||
if (IsA(j->larg, RangeTblRef))
|
if (IsA(j->larg, RangeTblRef))
|
||||||
|
@ -478,9 +478,8 @@ TypeNameListToString(List *typenames)
|
|||||||
initStringInfo(&string);
|
initStringInfo(&string);
|
||||||
foreach(l, typenames)
|
foreach(l, typenames)
|
||||||
{
|
{
|
||||||
TypeName *typeName = (TypeName *) lfirst(l);
|
TypeName *typeName = castNode(TypeName, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(typeName, TypeName));
|
|
||||||
if (l != list_head(typenames))
|
if (l != list_head(typenames))
|
||||||
appendStringInfoChar(&string, ',');
|
appendStringInfoChar(&string, ',');
|
||||||
appendTypeNameToBuffer(typeName, &string);
|
appendTypeNameToBuffer(typeName, &string);
|
||||||
|
@ -543,8 +543,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
|
|||||||
|
|
||||||
foreach(clist, column->constraints)
|
foreach(clist, column->constraints)
|
||||||
{
|
{
|
||||||
constraint = lfirst(clist);
|
constraint = castNode(Constraint, lfirst(clist));
|
||||||
Assert(IsA(constraint, Constraint));
|
|
||||||
|
|
||||||
switch (constraint->contype)
|
switch (constraint->contype)
|
||||||
{
|
{
|
||||||
@ -1520,9 +1519,8 @@ transformIndexConstraints(CreateStmtContext *cxt)
|
|||||||
*/
|
*/
|
||||||
foreach(lc, cxt->ixconstraints)
|
foreach(lc, cxt->ixconstraints)
|
||||||
{
|
{
|
||||||
Constraint *constraint = (Constraint *) lfirst(lc);
|
Constraint *constraint = castNode(Constraint, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(constraint, Constraint));
|
|
||||||
Assert(constraint->contype == CONSTR_PRIMARY ||
|
Assert(constraint->contype == CONSTR_PRIMARY ||
|
||||||
constraint->contype == CONSTR_UNIQUE ||
|
constraint->contype == CONSTR_UNIQUE ||
|
||||||
constraint->contype == CONSTR_EXCLUSION);
|
constraint->contype == CONSTR_EXCLUSION);
|
||||||
@ -1842,10 +1840,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
|||||||
List *opname;
|
List *opname;
|
||||||
|
|
||||||
Assert(list_length(pair) == 2);
|
Assert(list_length(pair) == 2);
|
||||||
elem = (IndexElem *) linitial(pair);
|
elem = castNode(IndexElem, linitial(pair));
|
||||||
Assert(IsA(elem, IndexElem));
|
opname = castNode(List, lsecond(pair));
|
||||||
opname = (List *) lsecond(pair);
|
|
||||||
Assert(IsA(opname, List));
|
|
||||||
|
|
||||||
index->indexParams = lappend(index->indexParams, elem);
|
index->indexParams = lappend(index->indexParams, elem);
|
||||||
index->excludeOpNames = lappend(index->excludeOpNames, opname);
|
index->excludeOpNames = lappend(index->excludeOpNames, opname);
|
||||||
@ -1872,8 +1868,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
|||||||
|
|
||||||
foreach(columns, cxt->columns)
|
foreach(columns, cxt->columns)
|
||||||
{
|
{
|
||||||
column = (ColumnDef *) lfirst(columns);
|
column = castNode(ColumnDef, lfirst(columns));
|
||||||
Assert(IsA(column, ColumnDef));
|
|
||||||
if (strcmp(column->colname, key) == 0)
|
if (strcmp(column->colname, key) == 0)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
@ -1902,11 +1897,10 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
|||||||
|
|
||||||
foreach(inher, cxt->inhRelations)
|
foreach(inher, cxt->inhRelations)
|
||||||
{
|
{
|
||||||
RangeVar *inh = (RangeVar *) lfirst(inher);
|
RangeVar *inh = castNode(RangeVar, lfirst(inher));
|
||||||
Relation rel;
|
Relation rel;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
Assert(IsA(inh, RangeVar));
|
|
||||||
rel = heap_openrv(inh, AccessShareLock);
|
rel = heap_openrv(inh, AccessShareLock);
|
||||||
/* check user requested inheritance from valid relkind */
|
/* check user requested inheritance from valid relkind */
|
||||||
if (rel->rd_rel->relkind != RELKIND_RELATION &&
|
if (rel->rd_rel->relkind != RELKIND_RELATION &&
|
||||||
@ -2586,9 +2580,8 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt,
|
|||||||
case AT_AddColumn:
|
case AT_AddColumn:
|
||||||
case AT_AddColumnToView:
|
case AT_AddColumnToView:
|
||||||
{
|
{
|
||||||
ColumnDef *def = (ColumnDef *) cmd->def;
|
ColumnDef *def = castNode(ColumnDef, cmd->def);
|
||||||
|
|
||||||
Assert(IsA(def, ColumnDef));
|
|
||||||
transformColumnDefinition(&cxt, def);
|
transformColumnDefinition(&cxt, def);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2693,9 +2686,8 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt,
|
|||||||
*/
|
*/
|
||||||
foreach(l, cxt.alist)
|
foreach(l, cxt.alist)
|
||||||
{
|
{
|
||||||
IndexStmt *idxstmt = (IndexStmt *) lfirst(l);
|
IndexStmt *idxstmt = castNode(IndexStmt, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(idxstmt, IndexStmt));
|
|
||||||
idxstmt = transformIndexStmt(relid, idxstmt, queryString);
|
idxstmt = transformIndexStmt(relid, idxstmt, queryString);
|
||||||
newcmd = makeNode(AlterTableCmd);
|
newcmd = makeNode(AlterTableCmd);
|
||||||
newcmd->subtype = OidIsValid(idxstmt->indexOid) ? AT_AddIndexConstraint : AT_AddIndex;
|
newcmd->subtype = OidIsValid(idxstmt->indexOid) ? AT_AddIndexConstraint : AT_AddIndex;
|
||||||
|
@ -2320,8 +2320,7 @@ view_cols_are_auto_updatable(Query *viewquery,
|
|||||||
* there should be a single base relation.
|
* there should be a single base relation.
|
||||||
*/
|
*/
|
||||||
Assert(list_length(viewquery->jointree->fromlist) == 1);
|
Assert(list_length(viewquery->jointree->fromlist) == 1);
|
||||||
rtr = (RangeTblRef *) linitial(viewquery->jointree->fromlist);
|
rtr = castNode(RangeTblRef, linitial(viewquery->jointree->fromlist));
|
||||||
Assert(IsA(rtr, RangeTblRef));
|
|
||||||
|
|
||||||
/* Initialize the optional return values */
|
/* Initialize the optional return values */
|
||||||
if (updatable_cols != NULL)
|
if (updatable_cols != NULL)
|
||||||
@ -2578,8 +2577,7 @@ adjust_view_column_set(Bitmapset *cols, List *targetlist)
|
|||||||
|
|
||||||
if (tle->resjunk)
|
if (tle->resjunk)
|
||||||
continue;
|
continue;
|
||||||
var = (Var *) tle->expr;
|
var = castNode(Var, tle->expr);
|
||||||
Assert(IsA(var, Var));
|
|
||||||
result = bms_add_member(result,
|
result = bms_add_member(result,
|
||||||
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
||||||
}
|
}
|
||||||
@ -2761,8 +2759,7 @@ rewriteTargetView(Query *parsetree, Relation view)
|
|||||||
* view contains a single base relation.
|
* view contains a single base relation.
|
||||||
*/
|
*/
|
||||||
Assert(list_length(viewquery->jointree->fromlist) == 1);
|
Assert(list_length(viewquery->jointree->fromlist) == 1);
|
||||||
rtr = (RangeTblRef *) linitial(viewquery->jointree->fromlist);
|
rtr = castNode(RangeTblRef, linitial(viewquery->jointree->fromlist));
|
||||||
Assert(IsA(rtr, RangeTblRef));
|
|
||||||
|
|
||||||
base_rt_index = rtr->rtindex;
|
base_rt_index = rtr->rtindex;
|
||||||
base_rte = rt_fetch(base_rt_index, viewquery->rtable);
|
base_rte = rt_fetch(base_rt_index, viewquery->rtable);
|
||||||
@ -3119,11 +3116,9 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
|
|||||||
foreach(lc1, parsetree->cteList)
|
foreach(lc1, parsetree->cteList)
|
||||||
{
|
{
|
||||||
CommonTableExpr *cte = (CommonTableExpr *) lfirst(lc1);
|
CommonTableExpr *cte = (CommonTableExpr *) lfirst(lc1);
|
||||||
Query *ctequery = (Query *) cte->ctequery;
|
Query *ctequery = castNode(Query, cte->ctequery);
|
||||||
List *newstuff;
|
List *newstuff;
|
||||||
|
|
||||||
Assert(IsA(ctequery, Query));
|
|
||||||
|
|
||||||
if (ctequery->commandType == CMD_SELECT)
|
if (ctequery->commandType == CMD_SELECT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -3137,8 +3132,7 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
|
|||||||
if (list_length(newstuff) == 1)
|
if (list_length(newstuff) == 1)
|
||||||
{
|
{
|
||||||
/* Push the single Query back into the CTE node */
|
/* Push the single Query back into the CTE node */
|
||||||
ctequery = (Query *) linitial(newstuff);
|
ctequery = castNode(Query, linitial(newstuff));
|
||||||
Assert(IsA(ctequery, Query));
|
|
||||||
/* WITH queries should never be canSetTag */
|
/* WITH queries should never be canSetTag */
|
||||||
Assert(!ctequery->canSetTag);
|
Assert(!ctequery->canSetTag);
|
||||||
cte->ctequery = (Node *) ctequery;
|
cte->ctequery = (Node *) ctequery;
|
||||||
|
@ -4591,11 +4591,10 @@ CheckDateTokenTables(void)
|
|||||||
Node *
|
Node *
|
||||||
TemporalTransform(int32 max_precis, Node *node)
|
TemporalTransform(int32 max_precis, Node *node)
|
||||||
{
|
{
|
||||||
FuncExpr *expr = (FuncExpr *) node;
|
FuncExpr *expr = castNode(FuncExpr, node);
|
||||||
Node *ret = NULL;
|
Node *ret = NULL;
|
||||||
Node *typmod;
|
Node *typmod;
|
||||||
|
|
||||||
Assert(IsA(expr, FuncExpr));
|
|
||||||
Assert(list_length(expr->args) >= 2);
|
Assert(list_length(expr->args) >= 2);
|
||||||
|
|
||||||
typmod = (Node *) lsecond(expr->args);
|
typmod = (Node *) lsecond(expr->args);
|
||||||
|
@ -889,11 +889,10 @@ numeric_send(PG_FUNCTION_ARGS)
|
|||||||
Datum
|
Datum
|
||||||
numeric_transform(PG_FUNCTION_ARGS)
|
numeric_transform(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
FuncExpr *expr = (FuncExpr *) PG_GETARG_POINTER(0);
|
FuncExpr *expr = castNode(FuncExpr, PG_GETARG_POINTER(0));
|
||||||
Node *ret = NULL;
|
Node *ret = NULL;
|
||||||
Node *typmod;
|
Node *typmod;
|
||||||
|
|
||||||
Assert(IsA(expr, FuncExpr));
|
|
||||||
Assert(list_length(expr->args) >= 2);
|
Assert(list_length(expr->args) >= 2);
|
||||||
|
|
||||||
typmod = (Node *) lsecond(expr->args);
|
typmod = (Node *) lsecond(expr->args);
|
||||||
|
@ -2569,8 +2569,7 @@ print_function_arguments(StringInfo buf, HeapTuple proctup,
|
|||||||
List *argdefaults;
|
List *argdefaults;
|
||||||
|
|
||||||
str = TextDatumGetCString(proargdefaults);
|
str = TextDatumGetCString(proargdefaults);
|
||||||
argdefaults = (List *) stringToNode(str);
|
argdefaults = castNode(List, stringToNode(str));
|
||||||
Assert(IsA(argdefaults, List));
|
|
||||||
pfree(str);
|
pfree(str);
|
||||||
nextargdefault = list_head(argdefaults);
|
nextargdefault = list_head(argdefaults);
|
||||||
/* nlackdefaults counts only *input* arguments lacking defaults */
|
/* nlackdefaults counts only *input* arguments lacking defaults */
|
||||||
@ -2762,8 +2761,7 @@ pg_get_function_arg_default(PG_FUNCTION_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
str = TextDatumGetCString(proargdefaults);
|
str = TextDatumGetCString(proargdefaults);
|
||||||
argdefaults = (List *) stringToNode(str);
|
argdefaults = castNode(List, stringToNode(str));
|
||||||
Assert(IsA(argdefaults, List));
|
|
||||||
pfree(str);
|
pfree(str);
|
||||||
|
|
||||||
proc = (Form_pg_proc) GETSTRUCT(proctup);
|
proc = (Form_pg_proc) GETSTRUCT(proctup);
|
||||||
@ -7654,9 +7652,8 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
appendStringInfoString(buf, "(alternatives: ");
|
appendStringInfoString(buf, "(alternatives: ");
|
||||||
foreach(lc, asplan->subplans)
|
foreach(lc, asplan->subplans)
|
||||||
{
|
{
|
||||||
SubPlan *splan = (SubPlan *) lfirst(lc);
|
SubPlan *splan = castNode(SubPlan, lfirst(lc));
|
||||||
|
|
||||||
Assert(IsA(splan, SubPlan));
|
|
||||||
if (splan->useHashTable)
|
if (splan->useHashTable)
|
||||||
appendStringInfo(buf, "hashed %s", splan->plan_name);
|
appendStringInfo(buf, "hashed %s", splan->plan_name);
|
||||||
else
|
else
|
||||||
@ -8210,8 +8207,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
get_rule_expr((Node *) linitial(xexpr->args),
|
get_rule_expr((Node *) linitial(xexpr->args),
|
||||||
context, true);
|
context, true);
|
||||||
|
|
||||||
con = (Const *) lsecond(xexpr->args);
|
con = castNode(Const, lsecond(xexpr->args));
|
||||||
Assert(IsA(con, Const));
|
|
||||||
Assert(!con->constisnull);
|
Assert(!con->constisnull);
|
||||||
if (DatumGetBool(con->constvalue))
|
if (DatumGetBool(con->constvalue))
|
||||||
appendStringInfoString(buf,
|
appendStringInfoString(buf,
|
||||||
@ -8234,8 +8230,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
else
|
else
|
||||||
get_rule_expr((Node *) con, context, false);
|
get_rule_expr((Node *) con, context, false);
|
||||||
|
|
||||||
con = (Const *) lthird(xexpr->args);
|
con = castNode(Const, lthird(xexpr->args));
|
||||||
Assert(IsA(con, Const));
|
|
||||||
if (con->constisnull)
|
if (con->constisnull)
|
||||||
/* suppress STANDALONE NO VALUE */ ;
|
/* suppress STANDALONE NO VALUE */ ;
|
||||||
else
|
else
|
||||||
@ -8743,10 +8738,9 @@ get_agg_expr(Aggref *aggref, deparse_context *context,
|
|||||||
*/
|
*/
|
||||||
if (DO_AGGSPLIT_COMBINE(aggref->aggsplit))
|
if (DO_AGGSPLIT_COMBINE(aggref->aggsplit))
|
||||||
{
|
{
|
||||||
TargetEntry *tle = linitial(aggref->args);
|
TargetEntry *tle = castNode(TargetEntry, linitial(aggref->args));
|
||||||
|
|
||||||
Assert(list_length(aggref->args) == 1);
|
Assert(list_length(aggref->args) == 1);
|
||||||
Assert(IsA(tle, TargetEntry));
|
|
||||||
resolve_special_varno((Node *) tle->expr, context, original_aggref,
|
resolve_special_varno((Node *) tle->expr, context, original_aggref,
|
||||||
get_agg_combine_expr);
|
get_agg_combine_expr);
|
||||||
return;
|
return;
|
||||||
@ -9205,9 +9199,8 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
|||||||
sep = "";
|
sep = "";
|
||||||
foreach(l, ((BoolExpr *) sublink->testexpr)->args)
|
foreach(l, ((BoolExpr *) sublink->testexpr)->args)
|
||||||
{
|
{
|
||||||
OpExpr *opexpr = (OpExpr *) lfirst(l);
|
OpExpr *opexpr = castNode(OpExpr, lfirst(l));
|
||||||
|
|
||||||
Assert(IsA(opexpr, OpExpr));
|
|
||||||
appendStringInfoString(buf, sep);
|
appendStringInfoString(buf, sep);
|
||||||
get_rule_expr(linitial(opexpr->args), context, true);
|
get_rule_expr(linitial(opexpr->args), context, true);
|
||||||
if (!opname)
|
if (!opname)
|
||||||
|
@ -6087,14 +6087,13 @@ deconstruct_indexquals(IndexPath *path)
|
|||||||
|
|
||||||
forboth(lcc, path->indexquals, lci, path->indexqualcols)
|
forboth(lcc, path->indexquals, lci, path->indexqualcols)
|
||||||
{
|
{
|
||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lcc);
|
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lcc));
|
||||||
int indexcol = lfirst_int(lci);
|
int indexcol = lfirst_int(lci);
|
||||||
Expr *clause;
|
Expr *clause;
|
||||||
Node *leftop,
|
Node *leftop,
|
||||||
*rightop;
|
*rightop;
|
||||||
IndexQualInfo *qinfo;
|
IndexQualInfo *qinfo;
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
|
||||||
clause = rinfo->clause;
|
clause = rinfo->clause;
|
||||||
|
|
||||||
qinfo = (IndexQualInfo *) palloc(sizeof(IndexQualInfo));
|
qinfo = (IndexQualInfo *) palloc(sizeof(IndexQualInfo));
|
||||||
|
@ -1309,11 +1309,10 @@ intervaltypmodleastfield(int32 typmod)
|
|||||||
Datum
|
Datum
|
||||||
interval_transform(PG_FUNCTION_ARGS)
|
interval_transform(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
FuncExpr *expr = (FuncExpr *) PG_GETARG_POINTER(0);
|
FuncExpr *expr = castNode(FuncExpr, PG_GETARG_POINTER(0));
|
||||||
Node *ret = NULL;
|
Node *ret = NULL;
|
||||||
Node *typmod;
|
Node *typmod;
|
||||||
|
|
||||||
Assert(IsA(expr, FuncExpr));
|
|
||||||
Assert(list_length(expr->args) >= 2);
|
Assert(list_length(expr->args) >= 2);
|
||||||
|
|
||||||
typmod = (Node *) lsecond(expr->args);
|
typmod = (Node *) lsecond(expr->args);
|
||||||
|
@ -679,11 +679,10 @@ varbit_send(PG_FUNCTION_ARGS)
|
|||||||
Datum
|
Datum
|
||||||
varbit_transform(PG_FUNCTION_ARGS)
|
varbit_transform(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
FuncExpr *expr = (FuncExpr *) PG_GETARG_POINTER(0);
|
FuncExpr *expr = castNode(FuncExpr, PG_GETARG_POINTER(0));
|
||||||
Node *ret = NULL;
|
Node *ret = NULL;
|
||||||
Node *typmod;
|
Node *typmod;
|
||||||
|
|
||||||
Assert(IsA(expr, FuncExpr));
|
|
||||||
Assert(list_length(expr->args) >= 2);
|
Assert(list_length(expr->args) >= 2);
|
||||||
|
|
||||||
typmod = (Node *) lsecond(expr->args);
|
typmod = (Node *) lsecond(expr->args);
|
||||||
|
@ -554,11 +554,10 @@ varcharsend(PG_FUNCTION_ARGS)
|
|||||||
Datum
|
Datum
|
||||||
varchar_transform(PG_FUNCTION_ARGS)
|
varchar_transform(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
FuncExpr *expr = (FuncExpr *) PG_GETARG_POINTER(0);
|
FuncExpr *expr = castNode(FuncExpr, PG_GETARG_POINTER(0));
|
||||||
Node *ret = NULL;
|
Node *ret = NULL;
|
||||||
Node *typmod;
|
Node *typmod;
|
||||||
|
|
||||||
Assert(IsA(expr, FuncExpr));
|
|
||||||
Assert(list_length(expr->args) >= 2);
|
Assert(list_length(expr->args) >= 2);
|
||||||
|
|
||||||
typmod = (Node *) lsecond(expr->args);
|
typmod = (Node *) lsecond(expr->args);
|
||||||
|
@ -7322,7 +7322,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
|
|||||||
}
|
}
|
||||||
else if (strcmp(stmt->name, "TRANSACTION SNAPSHOT") == 0)
|
else if (strcmp(stmt->name, "TRANSACTION SNAPSHOT") == 0)
|
||||||
{
|
{
|
||||||
A_Const *con = (A_Const *) linitial(stmt->args);
|
A_Const *con = castNode(A_Const, linitial(stmt->args));
|
||||||
|
|
||||||
if (stmt->is_local)
|
if (stmt->is_local)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
@ -7330,7 +7330,6 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
|
|||||||
errmsg("SET LOCAL TRANSACTION SNAPSHOT is not implemented")));
|
errmsg("SET LOCAL TRANSACTION SNAPSHOT is not implemented")));
|
||||||
|
|
||||||
WarnNoTransactionChain(isTopLevel, "SET TRANSACTION");
|
WarnNoTransactionChain(isTopLevel, "SET TRANSACTION");
|
||||||
Assert(IsA(con, A_Const));
|
|
||||||
Assert(nodeTag(&con->val) == T_String);
|
Assert(nodeTag(&con->val) == T_String);
|
||||||
ImportSnapshot(strVal(&con->val));
|
ImportSnapshot(strVal(&con->val));
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ PG_FUNCTION_INFO_V1(plpgsql_inline_handler);
|
|||||||
Datum
|
Datum
|
||||||
plpgsql_inline_handler(PG_FUNCTION_ARGS)
|
plpgsql_inline_handler(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
InlineCodeBlock *codeblock = (InlineCodeBlock *) DatumGetPointer(PG_GETARG_DATUM(0));
|
InlineCodeBlock *codeblock = castNode(InlineCodeBlock, DatumGetPointer(PG_GETARG_DATUM(0)));
|
||||||
PLpgSQL_function *func;
|
PLpgSQL_function *func;
|
||||||
FunctionCallInfoData fake_fcinfo;
|
FunctionCallInfoData fake_fcinfo;
|
||||||
FmgrInfo flinfo;
|
FmgrInfo flinfo;
|
||||||
@ -296,8 +296,6 @@ plpgsql_inline_handler(PG_FUNCTION_ARGS)
|
|||||||
Datum retval;
|
Datum retval;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
Assert(IsA(codeblock, InlineCodeBlock));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect to SPI manager
|
* Connect to SPI manager
|
||||||
*/
|
*/
|
||||||
|
@ -94,11 +94,9 @@ get_altertable_subcmdtypes(PG_FUNCTION_ARGS)
|
|||||||
foreach(cell, cmd->d.alterTable.subcmds)
|
foreach(cell, cmd->d.alterTable.subcmds)
|
||||||
{
|
{
|
||||||
CollectedATSubcmd *sub = lfirst(cell);
|
CollectedATSubcmd *sub = lfirst(cell);
|
||||||
AlterTableCmd *subcmd = (AlterTableCmd *) sub->parsetree;
|
AlterTableCmd *subcmd = castNode(AlterTableCmd, sub->parsetree);
|
||||||
const char *strtype;
|
const char *strtype;
|
||||||
|
|
||||||
Assert(IsA(subcmd, AlterTableCmd));
|
|
||||||
|
|
||||||
switch (subcmd->subtype)
|
switch (subcmd->subtype)
|
||||||
{
|
{
|
||||||
case AT_AddColumn:
|
case AT_AddColumn:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user