|
10 | 10 | *
|
11 | 11 | *
|
12 | 12 | * IDENTIFICATION
|
13 |
| - * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.185 2005/04/25 01:30:13 tgl Exp $ |
| 13 | + * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.186 2005/04/25 02:14:47 tgl Exp $ |
14 | 14 | *
|
15 | 15 | *-------------------------------------------------------------------------
|
16 | 16 | */
|
@@ -54,7 +54,6 @@ static BitmapHeapScan *create_bitmap_scan_plan(Query *root,
|
54 | 54 | List *tlist, List *scan_clauses);
|
55 | 55 | static Plan *create_bitmap_subplan(Query *root, Path *bitmapqual,
|
56 | 56 | List **qual, List **indexqual);
|
57 |
| -static List *create_bitmap_qual(Path *bitmapqual); |
58 | 57 | static TidScan *create_tidscan_plan(Query *root, TidPath *best_path,
|
59 | 58 | List *tlist, List *scan_clauses);
|
60 | 59 | static SubqueryScan *create_subqueryscan_plan(Query *root, Path *best_path,
|
@@ -981,86 +980,6 @@ create_bitmap_subplan(Query *root, Path *bitmapqual,
|
981 | 980 | return plan;
|
982 | 981 | }
|
983 | 982 |
|
984 |
| -/* |
985 |
| - * Given a bitmapqual tree, generate the equivalent ordinary expression tree |
986 |
| - * (which we need for the bitmapqualorig field of the BitmapHeapScan plan). |
987 |
| - * The result is expressed as an implicit-AND list. |
988 |
| - */ |
989 |
| -static List * |
990 |
| -create_bitmap_qual(Path *bitmapqual) |
991 |
| -{ |
992 |
| - List *result; |
993 |
| - List *sublist; |
994 |
| - |
995 |
| - if (IsA(bitmapqual, BitmapAndPath)) |
996 |
| - { |
997 |
| - BitmapAndPath *apath = (BitmapAndPath *) bitmapqual; |
998 |
| - ListCell *l; |
999 |
| - |
1000 |
| - result = NIL; |
1001 |
| - foreach(l, apath->bitmapquals) |
1002 |
| - { |
1003 |
| - sublist = create_bitmap_qual(lfirst(l)); |
1004 |
| - result = list_concat(result, sublist); |
1005 |
| - } |
1006 |
| - } |
1007 |
| - else if (IsA(bitmapqual, BitmapOrPath)) |
1008 |
| - { |
1009 |
| - BitmapOrPath *opath = (BitmapOrPath *) bitmapqual; |
1010 |
| - List *newlist = NIL; |
1011 |
| - ListCell *l; |
1012 |
| - |
1013 |
| - foreach(l, opath->bitmapquals) |
1014 |
| - { |
1015 |
| - sublist = create_bitmap_qual(lfirst(l)); |
1016 |
| - if (sublist == NIL) |
1017 |
| - { |
1018 |
| - /* constant TRUE input yields constant TRUE OR result */ |
1019 |
| - return NIL; |
1020 |
| - } |
1021 |
| - newlist = lappend(newlist, make_ands_explicit(sublist)); |
1022 |
| - } |
1023 |
| - result = list_make1(make_orclause(newlist)); |
1024 |
| - } |
1025 |
| - else if (IsA(bitmapqual, IndexPath)) |
1026 |
| - { |
1027 |
| - IndexPath *ipath = (IndexPath *) bitmapqual; |
1028 |
| - |
1029 |
| - result = get_actual_clauses(ipath->indexclauses); |
1030 |
| - } |
1031 |
| - else |
1032 |
| - { |
1033 |
| - elog(ERROR, "unrecognized node type: %d", nodeTag(bitmapqual)); |
1034 |
| - result = NIL; /* keep compiler quiet */ |
1035 |
| - } |
1036 |
| - |
1037 |
| - return result; |
1038 |
| -} |
1039 |
| - |
1040 |
| -/* |
1041 |
| - * Given a bitmapqual tree, generate the equivalent RestrictInfo list. |
1042 |
| - */ |
1043 |
| -List * |
1044 |
| -create_bitmap_restriction(Path *bitmapqual) |
1045 |
| -{ |
1046 |
| - List *bitmapquals; |
1047 |
| - List *bitmapclauses; |
1048 |
| - ListCell *l; |
1049 |
| - |
1050 |
| - bitmapquals = create_bitmap_qual(bitmapqual); |
1051 |
| - |
1052 |
| - /* must convert qual list to restrictinfos ... painful ... */ |
1053 |
| - bitmapclauses = NIL; |
1054 |
| - foreach(l, bitmapquals) |
1055 |
| - { |
1056 |
| - bitmapclauses = lappend(bitmapclauses, |
1057 |
| - make_restrictinfo((Expr *) lfirst(l), |
1058 |
| - true, true)); |
1059 |
| - } |
1060 |
| - |
1061 |
| - return bitmapclauses; |
1062 |
| -} |
1063 |
| - |
1064 | 983 | /*
|
1065 | 984 | * create_tidscan_plan
|
1066 | 985 | * Returns a tidscan plan for the base relation scanned by 'best_path'
|
@@ -1210,7 +1129,9 @@ create_nestloop_plan(Query *root,
|
1210 | 1129 | {
|
1211 | 1130 | List *bitmapclauses;
|
1212 | 1131 |
|
1213 |
| - bitmapclauses = create_bitmap_restriction(innerpath->bitmapqual); |
| 1132 | + bitmapclauses = |
| 1133 | + make_restrictinfo_from_bitmapqual(innerpath->bitmapqual, |
| 1134 | + true, true); |
1214 | 1135 | joinrestrictclauses =
|
1215 | 1136 | select_nonredundant_join_clauses(root,
|
1216 | 1137 | joinrestrictclauses,
|
|
0 commit comments