268 >--- * Loop to check proposed new path against old paths. Note it is possible
269 >--- * for more than one old path to be tossed out because new_path dominates
270 >--- * it.
272 >--- * We can't use foreach here because the loop body may delete the current
273 >--- * list cell.
...................................
339 >--->---/*
340 >--->--- * Remove current element from pathlist if dominated by new.
341 >--->--- */
342 //>->---if (remove_old)
343 //>->---{
344 //>->--->---parent_rel->pathlist = list_delete_cell(parent_rel->pathlist,
345 //>->--->--->--->--->--->--->--->--->--->--->--->---p1, p1_prev);
346
347 >--->--->---/*
348 >--->--->--- * Delete the data pointed-to by the deleted cell, if possible
349 >--->--->--- */
350 //>->--->---if (!IsA(old_path, IndexPath))
351 //>->--->--->---pfree(old_path);
352 >--->--->---/* p1_prev does not advance */
353 //>->---}
354 //>->---else
355 //>->---{
356 >--->--->---/* new belongs after this old path if it has cost >= old's */
357 >--->--->---if (costcmp >= 0)
358 >--->--->--->---insert_after = p1;
359 >--->--->---/* p1_prev advances */
360 >--->--->---p1_prev = p1;
361 //>->---}
362
363 >--->---/*
364 >--->--- * If we found an old path that dominates new_path, we can quit
365 >--->--- * scanning the pathlist; we will not add new_path, and we assume
366 >--->--- * new_path cannot dominate any other elements of the pathlist.
367 >--->--- */
368 >--->---if (!accept_new)
369 >--->--->---break;
370 >---}
371
372 //>-if (accept_new)
373 //>-{
374 >--->---/* Accept the new path: insert it at proper place in pathlist */
375 >--->---if (insert_after)
376 >--->--->---lappend_cell(parent_rel->pathlist, insert_after, new_path);
377 >--->---else
378 >--->--->---parent_rel->pathlist = lcons(new_path, parent_rel->pathlist);
379 //>-}
380 //>-else
381 //>-{
382 >--->---/* Reject and recycle the new path */
383 //>->---if (!IsA(new_path, IndexPath))
384 //>->--->---pfree(new_path);
385 //>-}
Best Regards
Huang Qi Victor
Computer Science of National University of Singapore