File tree Expand file tree Collapse file tree 1 file changed +11
-25
lines changed
src/backend/optimizer/path Expand file tree Collapse file tree 1 file changed +11
-25
lines changed Original file line number Diff line number Diff line change 7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.12 1998/02/26 04:32:43 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.13 1998/04/02 07:27:15 vadim Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -61,39 +61,25 @@ prune_joinrels(List *rel_list)
61
61
static List *
62
62
prune_joinrel (Rel * rel , List * other_rels )
63
63
{
64
- List * cur = NIL ;
65
- List * return_list = NIL ;
64
+ List * i = NIL ;
65
+ List * result = NIL ;
66
66
67
- /* find first relation that doesn't match */
68
- foreach (cur , other_rels )
67
+ foreach (i , other_rels )
69
68
{
70
- Rel * other_rel = (Rel * ) lfirst (cur );
71
-
72
- if (!same (rel -> relids , other_rel -> relids ))
73
- break ;
74
- }
75
-
76
- /* we now know cur doesn't match, or is NIL */
77
- return_list = cur ;
78
-
79
- /*
80
- * remove relations that do match, we use lnext so we can remove
81
- * easily
82
- */
83
- while (cur != NIL && lnext (cur ) != NIL )
84
- {
85
- Rel * other_rel = (Rel * ) lfirst (lnext (cur ));
86
-
69
+ Rel * other_rel = (Rel * ) lfirst (i );
70
+
87
71
if (same (rel -> relids , other_rel -> relids ))
88
72
{
89
73
rel -> pathlist = add_pathlist (rel ,
90
74
rel -> pathlist ,
91
75
other_rel -> pathlist );
92
- lnext (cur ) = lnext (lnext (cur )); /* delete it */
93
76
}
94
- cur = lnext (cur );
77
+ else
78
+ {
79
+ result = nconc (result , lcons (other_rel , NIL ));
80
+ }
95
81
}
96
- return return_list ;
82
+ return ( result ) ;
97
83
}
98
84
99
85
/*
You can’t perform that action at this time.
0 commit comments