bool using_parent_hint)
{
ListCell *cell;
- ListCell *next;
StringInfoData buf;
RangeTblEntry *rte = root->simple_rte_array[rel->relid];
Oid relationObjectId = rte->relid;
if (debug_level > 0)
initStringInfo(&buf);
- for (cell = list_head(rel->indexlist); cell; cell = next)
+ foreach (cell, rel->indexlist)
{
IndexOptInfo *info = (IndexOptInfo *) lfirst(cell);
char *indexname = get_rel_name(info->indexoid);
ListCell *l;
bool use_index = false;
- next = lnext(rel->indexlist, cell);
foreach(l, hint->indexnames)
{
char *hintname = (char *) lfirst(l);
}
if (!use_index)
- {
- rel->indexlist = list_delete_cell(rel->indexlist, cell);
-
- /*
- * The cells after the deleted cell have been moved towards the
- * list head by 1 element. the next iteration should visit the
- * cell at the same address if any.
- */
- if (next)
- next = cell;
- }
+ rel->indexlist = foreach_delete_current(rel->indexlist, cell);
pfree(indexname);
}
{
if (hstate->join_hint_level[i] != NIL)
{
- ListCell *next = NULL;
- for(l = list_head(hstate->join_hint_level[i]); l; l = next)
+ foreach (l, hstate->join_hint_level[i])
{
JoinMethodHint *hint = (JoinMethodHint *)lfirst(l);
- next = lnext(hstate->join_hint_level[i], l);
-
if (hint->inner_nrels == 0 &&
!(bms_intersect(hint->joinrelids, joinrelids) == NULL ||
bms_equal(bms_union(hint->joinrelids, joinrelids),
hint->joinrelids)))
{
hstate->join_hint_level[i] =
- list_delete_cell(hstate->join_hint_level[i], l);
- /*
- * The cells after the deleted cell have been moved
- * towards the list head by 1 element. the next
- * iteration should visit the cell at the same address
- * if any.
- */
- if (next)
- next = l;
+ foreach_delete_current(hstate->join_hint_level[i], l);
}
}
}