File tree 1 file changed +5
-11
lines changed
src/backend/optimizer/prep
1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 16
16
*
17
17
*
18
18
* IDENTIFICATION
19
- * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.18 2004/05/26 04:41:26 neilc Exp $
19
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.19 2004/05/26 18:35:41 tgl Exp $
20
20
*
21
21
*-------------------------------------------------------------------------
22
22
*/
@@ -897,12 +897,15 @@ simplify_jointree(Query *parse, Node *jtnode)
897
897
{
898
898
FromExpr * f = (FromExpr * ) jtnode ;
899
899
List * newlist = NIL ;
900
+ int children_remaining ;
900
901
ListCell * l ;
901
902
903
+ children_remaining = list_length (f -> fromlist );
902
904
foreach (l , f -> fromlist )
903
905
{
904
906
Node * child = (Node * ) lfirst (l );
905
907
908
+ children_remaining -- ;
906
909
/* Recursively simplify this child... */
907
910
child = simplify_jointree (parse , child );
908
911
/* Now, is it a FromExpr? */
@@ -917,16 +920,7 @@ simplify_jointree(Query *parse, Node *jtnode)
917
920
*/
918
921
FromExpr * subf = (FromExpr * ) child ;
919
922
int childlen = length (subf -> fromlist );
920
- int myothers ;
921
- ListCell * l2 ;
922
-
923
- /*
924
- * XXX: This is a quick hack, not sure of the proper
925
- * fix.
926
- */
927
- myothers = length (newlist );
928
- for_each_cell (l2 , lnext (l ))
929
- myothers ++ ;
923
+ int myothers = length (newlist ) + children_remaining ;
930
924
931
925
if (childlen <= 1 ||
932
926
(childlen + myothers ) <= from_collapse_limit )
You can’t perform that action at this time.
0 commit comments