I wrote:
> Will Leinweber <will(at)bitfission(dot)com> writes:
>> On 12.1, fresh initdb the following query gives me the error
>> "ERROR: failed to construct the join relation"
> Eyeing the plan produced by v11, I'm suspecting some oversight in
> the RTE_RESULT changes (4be058fe9); but I haven't actually bisected.
Yup: it's folding the join tree to the point where a PlaceHolderVar ends
up marked as to be evaluated by the same relation that uses it, and then
things go all pear-shaped. Here's a proposed patch for that.
regards, tom lane