mirror of
https://github.com/postgres/postgres.git
synced 2025-10-28 11:55:03 +03:00
Make more use of castNode()
This commit is contained in:
@@ -682,9 +682,8 @@ extract_nonindex_conditions(List *qual_clauses, List *indexquals)
|
||||
|
||||
foreach(lc, qual_clauses)
|
||||
{
|
||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
|
||||
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
|
||||
|
||||
Assert(IsA(rinfo, RestrictInfo));
|
||||
if (rinfo->pseudoconstant)
|
||||
continue; /* we may drop pseudoconstants here */
|
||||
if (list_member_ptr(indexquals, rinfo))
|
||||
@@ -1804,12 +1803,10 @@ cost_windowagg(Path *path, PlannerInfo *root,
|
||||
*/
|
||||
foreach(lc, windowFuncs)
|
||||
{
|
||||
WindowFunc *wfunc = (WindowFunc *) lfirst(lc);
|
||||
WindowFunc *wfunc = castNode(WindowFunc, lfirst(lc));
|
||||
Cost wfunccost;
|
||||
QualCost argcosts;
|
||||
|
||||
Assert(IsA(wfunc, WindowFunc));
|
||||
|
||||
wfunccost = get_func_cost(wfunc->winfnoid) * cpu_operator_cost;
|
||||
|
||||
/* 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;
|
||||
foreach(hcl, hashclauses)
|
||||
{
|
||||
RestrictInfo *restrictinfo = (RestrictInfo *) lfirst(hcl);
|
||||
RestrictInfo *restrictinfo = castNode(RestrictInfo, lfirst(hcl));
|
||||
Selectivity thisbucketsize;
|
||||
|
||||
Assert(IsA(restrictinfo, RestrictInfo));
|
||||
|
||||
/*
|
||||
* First we have to figure out which side of the hashjoin clause
|
||||
* is the inner side.
|
||||
@@ -3537,9 +3532,8 @@ compute_semi_anti_join_factors(PlannerInfo *root,
|
||||
joinquals = NIL;
|
||||
foreach(l, restrictlist)
|
||||
{
|
||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
||||
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||
|
||||
Assert(IsA(rinfo, RestrictInfo));
|
||||
if (!rinfo->is_pushed_down)
|
||||
joinquals = lappend(joinquals, rinfo);
|
||||
}
|
||||
@@ -3970,9 +3964,8 @@ calc_joinrel_size_estimate(PlannerInfo *root,
|
||||
/* Grovel through the clauses to separate into two lists */
|
||||
foreach(l, restrictlist)
|
||||
{
|
||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
|
||||
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(l));
|
||||
|
||||
Assert(IsA(rinfo, RestrictInfo));
|
||||
if (rinfo->is_pushed_down)
|
||||
pushedquals = lappend(pushedquals, rinfo);
|
||||
else
|
||||
@@ -4345,11 +4338,10 @@ set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
|
||||
*/
|
||||
foreach(lc, subroot->parse->targetList)
|
||||
{
|
||||
TargetEntry *te = (TargetEntry *) lfirst(lc);
|
||||
TargetEntry *te = castNode(TargetEntry, lfirst(lc));
|
||||
Node *texpr = (Node *) te->expr;
|
||||
int32 item_width = 0;
|
||||
|
||||
Assert(IsA(te, TargetEntry));
|
||||
/* junk columns aren't visible to upper query */
|
||||
if (te->resjunk)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user