aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVadim B. Mikheev <vadim4o@yahoo.com>1998-04-02 07:27:15 +0000
committerVadim B. Mikheev <vadim4o@yahoo.com>1998-04-02 07:27:15 +0000
commitbb80f8a918f88544df540b730d40c432321e8cde (patch)
tree4a603353743289faaa31b5af0fd056090217345e /src
parent91964bd98429ef89a9a462f7b7d508d697d7b352 (diff)
downloadpostgresql-bb80f8a918f88544df540b730d40c432321e8cde.tar.gz
postgresql-bb80f8a918f88544df540b730d40c432321e8cde.zip
Fix merging pathes of pruned rels ("indices are unused" problem).
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/path/prune.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/src/backend/optimizer/path/prune.c b/src/backend/optimizer/path/prune.c
index 014c72e9060..250a670fc43 100644
--- a/src/backend/optimizer/path/prune.c
+++ b/src/backend/optimizer/path/prune.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.12 1998/02/26 04:32:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.13 1998/04/02 07:27:15 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,39 +61,25 @@ prune_joinrels(List *rel_list)
static List *
prune_joinrel(Rel *rel, List *other_rels)
{
- List *cur = NIL;
- List *return_list = NIL;
+ List *i = NIL;
+ List *result = NIL;
- /* find first relation that doesn't match */
- foreach(cur, other_rels)
+ foreach(i, other_rels)
{
- Rel *other_rel = (Rel *) lfirst(cur);
-
- if (!same(rel->relids, other_rel->relids))
- break;
- }
-
- /* we now know cur doesn't match, or is NIL */
- return_list = cur;
-
- /*
- * remove relations that do match, we use lnext so we can remove
- * easily
- */
- while (cur != NIL && lnext(cur) != NIL)
- {
- Rel *other_rel = (Rel *) lfirst(lnext(cur));
-
+ Rel *other_rel = (Rel *) lfirst(i);
+
if (same(rel->relids, other_rel->relids))
{
rel->pathlist = add_pathlist(rel,
rel->pathlist,
other_rel->pathlist);
- lnext(cur) = lnext(lnext(cur)); /* delete it */
}
- cur = lnext(cur);
+ else
+ {
+ result = nconc(result, lcons(other_rel, NIL));
+ }
}
- return return_list;
+ return (result);
}
/*