1010 *
1111 *
1212 * IDENTIFICATION
13- * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.183 2005/04/22 21:58:31 tgl Exp $
13+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.184 2005/04/23 01:29:15 tgl Exp $
1414 *
1515 *-------------------------------------------------------------------------
1616 */
@@ -941,7 +941,10 @@ create_bitmap_subplan(Query *root, Path *bitmapqual)
941941 newlist = lappend (newlist , subplan );
942942 }
943943 plan = (Plan * ) make_bitmap_and (newlist );
944- copy_path_costsize (plan , bitmapqual );
944+ plan -> startup_cost = apath -> path .startup_cost ;
945+ plan -> total_cost = apath -> path .total_cost ;
946+ plan -> plan_rows =
947+ clamp_row_est (apath -> bitmapselectivity * apath -> path .parent -> tuples );
945948 plan -> plan_width = 0 ; /* meaningless */
946949 }
947950 else if (IsA (bitmapqual , BitmapOrPath ))
@@ -957,31 +960,32 @@ create_bitmap_subplan(Query *root, Path *bitmapqual)
957960 newlist = lappend (newlist , subplan );
958961 }
959962 plan = (Plan * ) make_bitmap_or (newlist );
960- copy_path_costsize (plan , bitmapqual );
963+ plan -> startup_cost = opath -> path .startup_cost ;
964+ plan -> total_cost = opath -> path .total_cost ;
965+ plan -> plan_rows =
966+ clamp_row_est (opath -> bitmapselectivity * opath -> path .parent -> tuples );
961967 plan -> plan_width = 0 ; /* meaningless */
962968 }
963969 else if (IsA (bitmapqual , IndexPath ))
964970 {
965971 IndexPath * ipath = (IndexPath * ) bitmapqual ;
966972 IndexScan * iscan ;
967- BitmapIndexScan * bscan ;
968973
969974 /* Use the regular indexscan plan build machinery... */
970975 iscan = create_indexscan_plan (root , ipath , NIL , NIL );
971976 Assert (list_length (iscan -> indxid ) == 1 );
972977 /* then convert to a bitmap indexscan */
973- bscan = make_bitmap_indexscan (iscan -> scan .scanrelid ,
974- linitial_oid (iscan -> indxid ),
975- linitial (iscan -> indxqual ),
976- linitial (iscan -> indxqualorig ),
977- linitial (iscan -> indxstrategy ),
978- linitial (iscan -> indxsubtype ));
979- bscan -> scan . plan . startup_cost = 0.0 ;
980- bscan -> scan . plan . total_cost = ipath -> indextotalcost ;
981- bscan -> scan . plan . plan_rows =
978+ plan = ( Plan * ) make_bitmap_indexscan (iscan -> scan .scanrelid ,
979+ linitial_oid (iscan -> indxid ),
980+ linitial (iscan -> indxqual ),
981+ linitial (iscan -> indxqualorig ),
982+ linitial (iscan -> indxstrategy ),
983+ linitial (iscan -> indxsubtype ));
984+ plan -> startup_cost = 0.0 ;
985+ plan -> total_cost = ipath -> indextotalcost ;
986+ plan -> plan_rows =
982987 clamp_row_est (ipath -> indexselectivity * ipath -> path .parent -> tuples );
983- bscan -> scan .plan .plan_width = 0 ; /* meaningless */
984- plan = (Plan * ) bscan ;
988+ plan -> plan_width = 0 ; /* meaningless */
985989 }
986990 else
987991 {
0 commit comments