diff options
Diffstat (limited to 'src/backend/optimizer/prep/prepqual.c')
-rw-r--r-- | src/backend/optimizer/prep/prepqual.c | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/src/backend/optimizer/prep/prepqual.c b/src/backend/optimizer/prep/prepqual.c index 2c39859a811..9fad52acfe0 100644 --- a/src/backend/optimizer/prep/prepqual.c +++ b/src/backend/optimizer/prep/prepqual.c @@ -25,7 +25,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepqual.c,v 1.50 2005/07/29 21:40:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepqual.c,v 1.51 2005/10/15 02:49:21 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -73,10 +73,10 @@ canonicalize_qual(Expr *qual) return NULL; /* - * Push down NOTs. We do this only in the top-level boolean - * expression, without examining arguments of operators/functions. The - * main reason for doing this is to expose as much top-level AND/OR - * structure as we can, so there's no point in descending further. + * Push down NOTs. We do this only in the top-level boolean expression, + * without examining arguments of operators/functions. The main reason for + * doing this is to expose as much top-level AND/OR structure as we can, + * so there's no point in descending further. */ newqual = find_nots(qual); @@ -110,12 +110,12 @@ pull_ands(List *andlist) /* * Note: we can destructively concat the subexpression's arglist * because we know the recursive invocation of pull_ands will have - * built a new arglist not shared with any other expr. Otherwise - * we'd need a list_copy here. + * built a new arglist not shared with any other expr. Otherwise we'd + * need a list_copy here. */ if (and_clause(subexpr)) out_list = list_concat(out_list, - pull_ands(((BoolExpr *) subexpr)->args)); + pull_ands(((BoolExpr *) subexpr)->args)); else out_list = lappend(out_list, subexpr); } @@ -142,12 +142,12 @@ pull_ors(List *orlist) /* * Note: we can destructively concat the subexpression's arglist * because we know the recursive invocation of pull_ors will have - * built a new arglist not shared with any other expr. Otherwise - * we'd need a list_copy here. + * built a new arglist not shared with any other expr. Otherwise we'd + * need a list_copy here. */ if (or_clause(subexpr)) out_list = list_concat(out_list, - pull_ors(((BoolExpr *) subexpr)->args)); + pull_ors(((BoolExpr *) subexpr)->args)); else out_list = lappend(out_list, subexpr); } @@ -249,8 +249,8 @@ push_nots(Expr *qual) { /* * Another NOT cancels this NOT, so eliminate the NOT and stop - * negating this branch. But search the subexpression for more - * NOTs to simplify. + * negating this branch. But search the subexpression for more NOTs + * to simplify. */ return find_nots(get_notclausearg(qual)); } @@ -307,8 +307,8 @@ find_duplicate_ors(Expr *qual) orlist = lappend(orlist, find_duplicate_ors(lfirst(temp))); /* - * Don't need pull_ors() since this routine will never introduce - * an OR where there wasn't one before. + * Don't need pull_ors() since this routine will never introduce an OR + * where there wasn't one before. */ return process_duplicate_ors(orlist); } @@ -353,10 +353,10 @@ process_duplicate_ors(List *orlist) return linitial(orlist); /* - * Choose the shortest AND clause as the reference list --- obviously, - * any subclause not in this clause isn't in all the clauses. If we - * find a clause that's not an AND, we can treat it as a one-element - * AND clause, which necessarily wins as shortest. + * Choose the shortest AND clause as the reference list --- obviously, any + * subclause not in this clause isn't in all the clauses. If we find a + * clause that's not an AND, we can treat it as a one-element AND clause, + * which necessarily wins as shortest. */ foreach(temp, orlist) { @@ -386,8 +386,8 @@ process_duplicate_ors(List *orlist) reference = list_union(NIL, reference); /* - * Check each element of the reference list to see if it's in all the - * OR clauses. Build a new list of winning clauses. + * Check each element of the reference list to see if it's in all the OR + * clauses. Build a new list of winning clauses. */ winners = NIL; foreach(temp, reference) @@ -431,13 +431,12 @@ process_duplicate_ors(List *orlist) /* * Generate new OR list consisting of the remaining sub-clauses. * - * If any clause degenerates to empty, then we have a situation like (A - * AND B) OR (A), which can be reduced to just A --- that is, the - * additional conditions in other arms of the OR are irrelevant. + * If any clause degenerates to empty, then we have a situation like (A AND + * B) OR (A), which can be reduced to just A --- that is, the additional + * conditions in other arms of the OR are irrelevant. * - * Note that because we use list_difference, any multiple occurrences of - * a winning clause in an AND sub-clause will be removed - * automatically. + * Note that because we use list_difference, any multiple occurrences of a + * winning clause in an AND sub-clause will be removed automatically. */ neworlist = NIL; foreach(temp, orlist) @@ -475,10 +474,10 @@ process_duplicate_ors(List *orlist) } /* - * Append reduced OR to the winners list, if it's not degenerate, - * handling the special case of one element correctly (can that really - * happen?). Also be careful to maintain AND/OR flatness in case we - * pulled up a sub-sub-OR-clause. + * Append reduced OR to the winners list, if it's not degenerate, handling + * the special case of one element correctly (can that really happen?). + * Also be careful to maintain AND/OR flatness in case we pulled up a + * sub-sub-OR-clause. */ if (neworlist != NIL) { |