* get_singleton_append_subpath * Returns the single subpath of an Append/MergeAppend, or just * return 'path' if it's not a single sub-path Append/MergeAppend. * * Note: 'path' must not be a parallel-aware path. */
| 2385 | * Note: 'path' must not be a parallel-aware path. |
| 2386 | */ |
| 2387 | static Path * |
| 2388 | get_singleton_append_subpath(Path *path) |
| 2389 | { |
| 2390 | Assert(!path->parallel_aware); |
| 2391 | |
| 2392 | if (IsA(path, AppendPath)) |
| 2393 | { |
| 2394 | AppendPath *apath = (AppendPath *) path; |
| 2395 | |
| 2396 | if (list_length(apath->subpaths) == 1) |
| 2397 | return (Path *) linitial(apath->subpaths); |
| 2398 | } |
| 2399 | else if (IsA(path, MergeAppendPath)) |
| 2400 | { |
| 2401 | MergeAppendPath *mpath = (MergeAppendPath *) path; |
| 2402 | |
| 2403 | if (list_length(mpath->subpaths) == 1) |
| 2404 | return (Path *) linitial(mpath->subpaths); |
| 2405 | } |
| 2406 | |
| 2407 | return path; |
| 2408 | } |
| 2409 | |
| 2410 | /* |
| 2411 | * set_dummy_rel_pathlist |
no test coverage detected