Re: BUG #5263: Query execution fails with "ERROR: FULL JOIN is only supported with merge-joinable join conditions"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jozsef Szalay <jszalay(at)storediq(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5263: Query execution fails with "ERROR: FULL JOIN is only supported with merge-joinable join conditions"
Date: 2010-01-05 23:34:56
Message-ID: 20576.1262734496@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jozsef Szalay <jszalay(at)storediq(dot)com> writes:
> Well, this is a real-world case for us :-). The actual sql is a lot more complicated (and it is machine-generated), but the bottom line is that we need to project constants as columns, and we need to be able to "combine" the results coming out of the sub-queries.
> Years ago (8.1.x), we found that a FULL OUTER JOIN actually performed better or at least as well as UNION [ALL] in most if not all of the cases we had to deal with. So for that reason, and b/c the outer join closely resembles the inner joins syntactically, we chose to go with the outer join rather than with the union in our query generator.

Hmph. The FULL JOIN construct would have forced sorting of each of the
inputs, so it's pretty hard to see how it wouldn't lose to a UNION ALL.

You're also fortunate to have not run into the problem before, because
we've never supported FULL JOIN ON FALSE (until about five minutes ago)
and so whether it worked would depend on whether the planner was smart
enough to recognize the impossibility of the join condition. I guess
with sufficiently stylized output from a query generator maybe you'd
never have hit it...

Anyway, I've applied a patch to cover this case.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message tomas 2010-01-06 08:48:27 Re: BUG #5266: erros no servidor web
Previous Message Jozsef Szalay 2010-01-05 22:20:18 Re: BUG #5263: Query execution fails with "ERROR: FULL JOIN is only supported with merge-joinable join conditions"