* Build a target list (ie, a list of TargetEntry) for the Path's output. * * This is almost just make_tlist_from_pathtarget(), but we also have to * deal with replacing nestloop params. */
| 896 | * deal with replacing nestloop params. |
| 897 | */ |
| 898 | static List * |
| 899 | build_path_tlist(PlannerInfo *root, Path *path) |
| 900 | { |
| 901 | List *tlist = NIL; |
| 902 | Index *sortgrouprefs = path->pathtarget->sortgrouprefs; |
| 903 | int resno = 1; |
| 904 | ListCell *v; |
| 905 | |
| 906 | foreach(v, path->pathtarget->exprs) |
| 907 | { |
| 908 | Node *node = (Node *) lfirst(v); |
| 909 | TargetEntry *tle; |
| 910 | |
| 911 | /* |
| 912 | * If it's a parameterized path, there might be lateral references in |
| 913 | * the tlist, which need to be replaced with Params. There's no need |
| 914 | * to remake the TargetEntry nodes, so apply this to each list item |
| 915 | * separately. |
| 916 | */ |
| 917 | if (path->param_info) |
| 918 | node = replace_nestloop_params(root, node); |
| 919 | |
| 920 | tle = makeTargetEntry((Expr *) node, |
| 921 | resno, |
| 922 | NULL, |
| 923 | false); |
| 924 | if (sortgrouprefs) |
| 925 | tle->ressortgroupref = sortgrouprefs[resno - 1]; |
| 926 | |
| 927 | tlist = lappend(tlist, tle); |
| 928 | resno++; |
| 929 | } |
| 930 | return tlist; |
| 931 | } |
| 932 | |
| 933 | /* |
| 934 | * use_physical_tlist |
no test coverage detected