*** pgsql/src/backend/optimizer/path/allpaths.c 2009/01/01 17:23:43 1.179 --- pgsql/src/backend/optimizer/path/allpaths.c 2009/02/15 20:16:21 1.180 *************** *** 8,14 **** * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.178 2008/12/28 18:53:56 tgl Exp $ * *------------------------------------------------------------------------- */ --- 8,14 ---- * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.179 2009/01/01 17:23:43 momjian Exp $ * *------------------------------------------------------------------------- */ *************** set_plain_rel_pathlist(PlannerInfo *root *** 225,243 **** return; } /* Mark rel with estimated output rows, width, etc */ set_baserel_size_estimates(root, rel); - /* Test any partial indexes of rel for applicability */ - check_partial_indexes(root, rel); - /* * Check to see if we can extract any restriction conditions from join * quals that are OR-of-AND structures. If so, add them to the rel's ! * restriction list, and recompute the size estimates. */ if (create_or_index_quals(root, rel)) set_baserel_size_estimates(root, rel); /* * Generate paths and add them to the rel's pathlist. --- 225,249 ---- return; } + /* + * Test any partial indexes of rel for applicability. We must do this + * first since partial unique indexes can affect size estimates. + */ + check_partial_indexes(root, rel); + /* Mark rel with estimated output rows, width, etc */ set_baserel_size_estimates(root, rel); /* * Check to see if we can extract any restriction conditions from join * quals that are OR-of-AND structures. If so, add them to the rel's ! * restriction list, and redo the above steps. */ if (create_or_index_quals(root, rel)) + { + check_partial_indexes(root, rel); set_baserel_size_estimates(root, rel); + } /* * Generate paths and add them to the rel's pathlist.