diff options
Diffstat (limited to 'src/backend/optimizer/path/joinpath.c')
-rw-r--r-- | src/backend/optimizer/path/joinpath.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index 8a666e80d89..ac6838d26e0 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.85 2004/01/05 05:07:35 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.86 2004/04/06 18:46:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -489,9 +489,27 @@ match_unsorted_outer(Query *root, outerpath->pathkeys, mergeclause_list); - /* Done with this outer path if no chance for a mergejoin */ + /* + * Done with this outer path if no chance for a mergejoin. + * + * Special corner case: for "x FULL JOIN y ON true", there will be + * no join clauses at all. Ordinarily we'd generate a clauseless + * nestloop path, but since mergejoin is our only join type that + * supports FULL JOIN, it's necessary to generate a clauseless + * mergejoin path instead. + * + * Unfortunately this can't easily be extended to handle the case + * where there are joinclauses but none of them use mergejoinable + * operators; nodeMergejoin.c can only do a full join correctly if + * all the joinclauses are mergeclauses. + */ if (mergeclauses == NIL) - continue; + { + if (jointype == JOIN_FULL && restrictlist == NIL) + /* okay to try for mergejoin */ ; + else + continue; + } if (useallclauses && length(mergeclauses) != length(mergeclause_list)) continue; |