mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
Make more use of castNode()
This commit is contained in:
@@ -1748,10 +1748,9 @@ is_simple_union_all(Query *subquery)
|
||||
elog(ERROR, "subquery is bogus");
|
||||
|
||||
/* Is it a set-operation query at all? */
|
||||
topop = (SetOperationStmt *) subquery->setOperations;
|
||||
topop = castNode(SetOperationStmt, subquery->setOperations);
|
||||
if (!topop)
|
||||
return false;
|
||||
Assert(IsA(topop, SetOperationStmt));
|
||||
|
||||
/* Can't handle ORDER BY, LIMIT/OFFSET, locking, or WITH */
|
||||
if (subquery->sortClause ||
|
||||
@@ -2323,8 +2322,8 @@ flatten_simple_union_all(PlannerInfo *root)
|
||||
RangeTblRef *rtr;
|
||||
|
||||
/* Shouldn't be called unless query has setops */
|
||||
topop = (SetOperationStmt *) parse->setOperations;
|
||||
Assert(topop && IsA(topop, SetOperationStmt));
|
||||
topop = castNode(SetOperationStmt, parse->setOperations);
|
||||
Assert(topop);
|
||||
|
||||
/* Can't optimize away a recursive UNION */
|
||||
if (root->hasRecursion)
|
||||
|
||||
@@ -129,7 +129,7 @@ RelOptInfo *
|
||||
plan_set_operations(PlannerInfo *root)
|
||||
{
|
||||
Query *parse = root->parse;
|
||||
SetOperationStmt *topop = (SetOperationStmt *) parse->setOperations;
|
||||
SetOperationStmt *topop = castNode(SetOperationStmt, parse->setOperations);
|
||||
Node *node;
|
||||
RangeTblEntry *leftmostRTE;
|
||||
Query *leftmostQuery;
|
||||
@@ -137,7 +137,7 @@ plan_set_operations(PlannerInfo *root)
|
||||
Path *path;
|
||||
List *top_tlist;
|
||||
|
||||
Assert(topop && IsA(topop, SetOperationStmt));
|
||||
Assert(topop);
|
||||
|
||||
/* check for unsupported stuff */
|
||||
Assert(parse->jointree->fromlist == NIL);
|
||||
@@ -1701,12 +1701,11 @@ translate_col_privs(const Bitmapset *parent_privs,
|
||||
attno = InvalidAttrNumber;
|
||||
foreach(lc, translated_vars)
|
||||
{
|
||||
Var *var = (Var *) lfirst(lc);
|
||||
Var *var = castNode(Var, lfirst(lc));
|
||||
|
||||
attno++;
|
||||
if (var == NULL) /* ignore dropped columns */
|
||||
continue;
|
||||
Assert(IsA(var, Var));
|
||||
if (whole_row ||
|
||||
bms_is_member(attno - FirstLowInvalidHeapAttributeNumber,
|
||||
parent_privs))
|
||||
|
||||
Reference in New Issue
Block a user