mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Add support for doing FULL JOIN ON FALSE. While this is really a rather
peculiar variant of UNION ALL, and so wouldn't likely get written directly as-is, it's possible for it to arise as a result of simplification of less-obviously-silly queries. In particular, now that we can do flattening of subqueries that have constant outputs and are underneath an outer join, it's possible for the case to result from simplification of queries of the type exhibited in bug #5263. Back-patch to 8.4 to avoid a functionality regression for this type of query.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.128 2010/01/02 16:57:46 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.129 2010/01/05 23:25:36 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1184,10 +1184,18 @@ select_mergejoin_clauses(PlannerInfo *root,
|
||||
if (isouterjoin && restrictinfo->is_pushed_down)
|
||||
continue;
|
||||
|
||||
/* Check that clause is a mergeable operator clause */
|
||||
if (!restrictinfo->can_join ||
|
||||
restrictinfo->mergeopfamilies == NIL)
|
||||
{
|
||||
have_nonmergeable_joinclause = true;
|
||||
/*
|
||||
* The executor can handle extra joinquals that are constants,
|
||||
* but not anything else, when doing right/full merge join. (The
|
||||
* reason to support constants is so we can do FULL JOIN ON
|
||||
* FALSE.)
|
||||
*/
|
||||
if (!restrictinfo->clause || !IsA(restrictinfo->clause, Const))
|
||||
have_nonmergeable_joinclause = true;
|
||||
continue; /* not mergejoinable */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user