From a4ca84231973395be9a6a415f286573decd2cd61 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 28 Jul 2005 20:26:22 +0000 Subject: Fix a bunch of bad interactions between partial indexes and the new planning logic for bitmap indexscans. Partial indexes create corner cases in which a scan might be done with no explicit index qual conditions, and the code wasn't handling those cases nicely. Also be a little tenser about eliminating redundant clauses in the generated plan. Per report from Dmitry Karasik. --- src/backend/optimizer/plan/planagg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/backend/optimizer/plan/planagg.c') diff --git a/src/backend/optimizer/plan/planagg.c b/src/backend/optimizer/plan/planagg.c index 0208e910536..81f526ac113 100644 --- a/src/backend/optimizer/plan/planagg.c +++ b/src/backend/optimizer/plan/planagg.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.6 2005/07/23 21:05:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.7 2005/07/28 20:26:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -313,6 +313,7 @@ build_minmax_path(PlannerInfo *root, RelOptInfo *rel, MinMaxAggInfo *info) List *restrictclauses; IndexPath *new_path; Cost new_cost; + bool found_clause; /* Ignore non-btree indexes */ if (index->relam != BTREE_AM_OID) @@ -346,7 +347,8 @@ build_minmax_path(PlannerInfo *root, RelOptInfo *rel, MinMaxAggInfo *info) restrictclauses = group_clauses_by_indexkey(index, index->rel->baserestrictinfo, NIL, - NULL); + NULL, + &found_clause); if (list_length(restrictclauses) < indexcol) continue; /* definitely haven't got enough */ -- cgit v1.2.3