-/****************************************************************************
- * ---- PATH CREATION UTILITIES ----
- ****************************************************************************/
-
-/*
- * flatten_clausegroups_list
- * Given a list of lists of RestrictInfos, flatten it to a list
- * of RestrictInfos.
- *
- * This is used to flatten out a list of sublists of index clauses (such as
- * the result of group_clauses_by_indexkey()) into a single list, for use
- * where we don't care which clause goes with which index column. The input
- * list structure mustn't be altered, but it's OK to share copies of the
- * underlying RestrictInfos.
- */
-List *
-flatten_clausegroups_list(List *clausegroups)
-{
- List *allclauses = NIL;
- ListCell *l;
-
- foreach(l, clausegroups)
- allclauses = list_concat(allclauses, list_copy((List *) lfirst(l)));
- return allclauses;
-}
-
-/*
- * flatten_indexorderbys_list
- * Given a list of lists of lists of ORDER BY expressions, flatten it.
- *
- * This is similar to flatten_clausegroups_list, but is used to flatten the
- * three-list-level result of match_index_to_pathkeys(). We assume the
- * bottom lists each have zero or one member.
- */
-List *
-flatten_indexorderbys_list(List *indexorderbys)
-{
- List *allclauses = NIL;
- ListCell *lc1;
-
- foreach(lc1, indexorderbys)
- {
- List *sublist = (List *) lfirst(lc1);
- ListCell *lc2;
-
- foreach(lc2, sublist)
- {
- List *subsublist = (List *) lfirst(lc2);
-
- if (subsublist == NIL)
- continue;
- Assert(list_length(subsublist) == 1);
- allclauses = lappend(allclauses, (Expr *) linitial(subsublist));
- }
- }
- return allclauses;
-}
-
-