* transformSortClause - * transform an ORDER BY clause * * ORDER BY items will be added to the targetlist (as resjunk columns) * if not already present, so the targetlist must be passed by reference. * * This is also used for window and aggregate ORDER BY clauses (which act * almost the same, but are always interpreted per SQL99 rules). */
| 2816 | * almost the same, but are always interpreted per SQL99 rules). |
| 2817 | */ |
| 2818 | List * |
| 2819 | transformSortClause(ParseState *pstate, |
| 2820 | List *orderlist, |
| 2821 | List **targetlist, |
| 2822 | ParseExprKind exprKind, |
| 2823 | bool useSQL99) |
| 2824 | { |
| 2825 | List *sortlist = NIL; |
| 2826 | ListCell *olitem; |
| 2827 | |
| 2828 | foreach(olitem, orderlist) |
| 2829 | { |
| 2830 | SortBy *sortby = (SortBy *) lfirst(olitem); |
| 2831 | TargetEntry *tle; |
| 2832 | |
| 2833 | if (useSQL99) |
| 2834 | tle = findTargetlistEntrySQL99(pstate, sortby->node, |
| 2835 | targetlist, exprKind); |
| 2836 | else |
| 2837 | tle = findTargetlistEntrySQL92(pstate, sortby->node, |
| 2838 | targetlist, exprKind); |
| 2839 | |
| 2840 | sortlist = addTargetToSortList(pstate, tle, |
| 2841 | sortlist, *targetlist, sortby); |
| 2842 | } |
| 2843 | |
| 2844 | return sortlist; |
| 2845 | } |
| 2846 | |
| 2847 | /* |
| 2848 | * transformWindowDefinitions - |
no test coverage detected