|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.48 2000/09/29 18:21:32 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.49 2000/12/18 06:50:51 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -262,9 +262,18 @@ make_rels_by_clause_joins(Query *root,
|
262 | 262 | RelOptInfo*other_rel= (RelOptInfo*)lfirst(j);
|
263 | 263 |
|
264 | 264 | if (is_subseti(unjoined_relids,other_rel->relids))
|
265 |
| -result=lcons(make_join_rel(root,old_rel,other_rel, |
266 |
| -JOIN_INNER), |
267 |
| -result); |
| 265 | +{ |
| 266 | +RelOptInfo*jrel; |
| 267 | + |
| 268 | +jrel=make_join_rel(root,old_rel,other_rel,JOIN_INNER); |
| 269 | +/* |
| 270 | + * Avoid entering same joinrel into our output list more |
| 271 | + * than once. (make_rels_by_joins doesn't really care, |
| 272 | + * but GEQO does.) |
| 273 | + */ |
| 274 | +if (!ptrMember(jrel,result)) |
| 275 | +result=lcons(jrel,result); |
| 276 | +} |
268 | 277 | }
|
269 | 278 | }
|
270 | 279 |
|
@@ -297,9 +306,16 @@ make_rels_by_clauseless_joins(Query *root,
|
297 | 306 | RelOptInfo*other_rel= (RelOptInfo*)lfirst(i);
|
298 | 307 |
|
299 | 308 | if (nonoverlap_setsi(other_rel->relids,old_rel->relids))
|
300 |
| -result=lcons(make_join_rel(root,old_rel,other_rel, |
301 |
| -JOIN_INNER), |
302 |
| -result); |
| 309 | +{ |
| 310 | +RelOptInfo*jrel; |
| 311 | + |
| 312 | +jrel=make_join_rel(root,old_rel,other_rel,JOIN_INNER); |
| 313 | +/* |
| 314 | + * As long as given other_rels are distinct, don't need |
| 315 | + * to test to see if jrel is already part of output list. |
| 316 | + */ |
| 317 | +result=lcons(jrel,result); |
| 318 | +} |
303 | 319 | }
|
304 | 320 |
|
305 | 321 | returnresult;
|
|