From 7afd56c3c6d8360a5bfdfb2de30038b239fd756b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 26 Jan 2017 22:09:34 -0500 Subject: Use castNode() in a bunch of statement-list-related code. When I wrote commit ab1f0c822, I really missed the castNode() macro that Peter E. had proposed shortly before. This back-fills the uses I would have put it to. It's probably not all that significant, but there are more assertions here than there were before, and conceivably they will help catch any bugs associated with those representation changes. I left behind a number of usages like "(Query *) copyObject(query_var)". Those could have been converted as well, but Peter has proposed another notational improvement that would handle copyObject cases automatically, so I let that be for now. --- src/backend/executor/functions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/executor/functions.c') diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 15c709139ad..2d49a656502 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -707,7 +707,7 @@ init_sql_fcache(FmgrInfo *finfo, Oid collation, bool lazyEvalOK) flat_query_list = NIL; foreach(lc, raw_parsetree_list) { - RawStmt *parsetree = (RawStmt *) lfirst(lc); + RawStmt *parsetree = castNode(RawStmt, lfirst(lc)); List *queryTree_sublist; queryTree_sublist = pg_analyze_and_rewrite_params(parsetree, @@ -1551,7 +1551,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, parse = NULL; foreach(lc, queryTreeList) { - Query *q = (Query *) lfirst(lc); + Query *q = castNode(Query, lfirst(lc)); if (q->canSetTag) parse = q; -- cgit v1.2.3