@ -979,7 +979,7 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist,
is_transient = false ;
foreach ( lc , plist )
{
PlannedStmt * plannedstmt = castN ode( PlannedStmt , lfirst ( lc ) ) ;
PlannedStmt * plannedstmt = lfirst_n ode( PlannedStmt , lc ) ;
if ( plannedstmt - > commandType = = CMD_UTILITY )
continue ; /* Ignore utility statements */
@ -1074,7 +1074,7 @@ cached_plan_cost(CachedPlan *plan, bool include_planner)
foreach ( lc , plan - > stmt_list )
{
PlannedStmt * plannedstmt = castN ode( PlannedStmt , lfirst ( lc ) ) ;
PlannedStmt * plannedstmt = lfirst_n ode( PlannedStmt , lc ) ;
if ( plannedstmt - > commandType = = CMD_UTILITY )
continue ; /* Ignore utility statements */
@ -1462,7 +1462,7 @@ QueryListGetPrimaryStmt(List *stmts)
foreach ( lc , stmts )
{
Query * stmt = castN ode( Query , lfirst ( lc ) ) ;
Query * stmt = lfirst_n ode( Query , lc ) ;
if ( stmt - > canSetTag )
return stmt ;
@ -1481,7 +1481,7 @@ AcquireExecutorLocks(List *stmt_list, bool acquire)
foreach ( lc1 , stmt_list )
{
PlannedStmt * plannedstmt = castN ode( PlannedStmt , lfirst ( l c1 ) ) ;
PlannedStmt * plannedstmt = lfirst_n ode( PlannedStmt , lc1 ) ;
int rt_index ;
ListCell * lc2 ;
@ -1551,7 +1551,7 @@ AcquirePlannerLocks(List *stmt_list, bool acquire)
foreach ( lc , stmt_list )
{
Query * query = castN ode( Query , lfirst ( lc ) ) ;
Query * query = lfirst_n ode( Query , lc ) ;
if ( query - > commandType = = CMD_UTILITY )
{
@ -1618,7 +1618,7 @@ ScanQueryForLocks(Query *parsetree, bool acquire)
/* Recurse into subquery-in-WITH */
foreach ( lc , parsetree - > cteList )
{
CommonTableExpr * cte = castN ode( CommonTableExpr , lfirst ( lc ) ) ;
CommonTableExpr * cte = lfirst_n ode( CommonTableExpr , lc ) ;
ScanQueryForLocks ( castNode ( Query , cte - > ctequery ) , acquire ) ;
}
@ -1676,7 +1676,7 @@ PlanCacheComputeResultDesc(List *stmt_list)
{
case PORTAL_ONE_SELECT :
case PORTAL_ONE_MOD_WITH :
query = castN ode( Query , linitial ( stmt_list ) ) ;
query = linitial_n ode( Query , stmt_list ) ;
return ExecCleanTypeFromTL ( query - > targetList , false ) ;
case PORTAL_ONE_RETURNING :
@ -1685,7 +1685,7 @@ PlanCacheComputeResultDesc(List *stmt_list)
return ExecCleanTypeFromTL ( query - > returningList , false ) ;
case PORTAL_UTIL_SELECT :
query = castN ode( Query , linitial ( stmt_list ) ) ;
query = linitial_n ode( Query , stmt_list ) ;
Assert ( query - > utilityStmt ) ;
return UtilityTupleDescriptor ( query - > utilityStmt ) ;
@ -1742,7 +1742,7 @@ PlanCacheRelCallback(Datum arg, Oid relid)
foreach ( lc , plansource - > gplan - > stmt_list )
{
PlannedStmt * plannedstmt = castN ode( PlannedStmt , lfirst ( lc ) ) ;
PlannedStmt * plannedstmt = lfirst_n ode( PlannedStmt , lc ) ;
if ( plannedstmt - > commandType = = CMD_UTILITY )
continue ; /* Ignore utility statements */
@ -1815,7 +1815,7 @@ PlanCacheFuncCallback(Datum arg, int cacheid, uint32 hashvalue)
{
foreach ( lc , plansource - > gplan - > stmt_list )
{
PlannedStmt * plannedstmt = castN ode( PlannedStmt , lfirst ( lc ) ) ;
PlannedStmt * plannedstmt = lfirst_n ode( PlannedStmt , lc ) ;
ListCell * lc3 ;
if ( plannedstmt - > commandType = = CMD_UTILITY )
@ -1888,7 +1888,7 @@ ResetPlanCache(void)
*/
foreach ( lc , plansource - > query_list )
{
Query * query = castN ode( Query , lfirst ( lc ) ) ;
Query * query = lfirst_n ode( Query , lc ) ;
if ( query - > commandType ! = CMD_UTILITY | |
UtilityContainsQuery ( query - > utilityStmt ) )