From e4bd9127cb3e4f0eb8aa1b4fe5f4838011b4f2e5 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 23 Dec 1997 03:27:23 +0000 Subject: [PATCH] Remove regression in function. --- src/backend/optimizer/path/prune.c | 38 ++++++++++++++++++------------ 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/backend/optimizer/path/prune.c b/src/backend/optimizer/path/prune.c index 26bd559696..f7ff4e206c 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.7 1997/12/21 05:18:21 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.8 1997/12/23 03:27:23 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -210,22 +210,30 @@ prune_oldrels(List *old_rels) { Rel *rel; List *joininfo_list, - *xjoininfo; + *xjoininfo, + *i, + *temp_list = NIL; - if (old_rels == NIL) - return (NIL); - - rel = (Rel *) lfirst(old_rels); - joininfo_list = rel->joininfo; - if (joininfo_list == NIL) - return (lcons(rel, prune_oldrels(lnext(old_rels)))); - - foreach(xjoininfo, joininfo_list) + foreach(i, old_rels) { - JInfo *joininfo = (JInfo *) lfirst(xjoininfo); + rel = (Rel *) lfirst(i); + joininfo_list = rel->joininfo; - if (!joininfo->inactive) - return (lcons(rel, prune_oldrels(lnext(old_rels)))); + if (joininfo_list == NIL) + temp_list = lcons(rel, temp_list); + else + { + foreach(xjoininfo, joininfo_list) + { + JInfo *joininfo = (JInfo *) lfirst(xjoininfo); + + if (!joininfo->inactive) + { + temp_list = lcons(rel, temp_list); + break; + } + } + } } - return (prune_oldrels(lnext(old_rels))); + return temp_list; } -- 2.40.0