mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Make more use of castNode()
This commit is contained in:
@ -2382,8 +2382,8 @@ subquery_is_pushdown_safe(Query *subquery, Query *topquery,
|
||||
if (subquery->setOperations != NULL)
|
||||
return false;
|
||||
/* Check whether setop component output types match top level */
|
||||
topop = (SetOperationStmt *) topquery->setOperations;
|
||||
Assert(topop && IsA(topop, SetOperationStmt));
|
||||
topop = castNode(SetOperationStmt, topquery->setOperations);
|
||||
Assert(topop);
|
||||
compare_tlist_datatypes(subquery->targetList,
|
||||
topop->colTypes,
|
||||
safetyInfo);
|
||||
|
@ -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;
|
||||
|
@ -1273,12 +1273,11 @@ generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
foreach(lc, clauses)
|
||||
{
|
||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
|
||||
RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
|
||||
List *pathlist;
|
||||
Path *bitmapqual;
|
||||
ListCell *j;
|
||||
|
||||
Assert(IsA(rinfo, RestrictInfo));
|
||||
/* Ignore RestrictInfos that aren't ORs */
|
||||
if (!restriction_is_or_clause(rinfo))
|
||||
continue;
|
||||
@ -1310,10 +1309,10 @@ generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel,
|
||||
}
|
||||
else
|
||||
{
|
||||
RestrictInfo *rinfo = castNode(RestrictInfo, orarg);
|
||||
List *orargs;
|
||||
|
||||
Assert(IsA(orarg, RestrictInfo));
|
||||
Assert(!restriction_is_or_clause((RestrictInfo *) orarg));
|
||||
Assert(!restriction_is_or_clause(rinfo));
|
||||
orargs = list_make1(orarg);
|
||||
|
||||
indlist = build_paths_for_OR(root, rel,
|
||||
@ -2174,9 +2173,8 @@ match_clauses_to_index(IndexOptInfo *index,
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1230,9 +1230,8 @@ restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
|
||||
*/
|
||||
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)
|
||||
continue;
|
||||
|
||||
|
Reference in New Issue
Block a user