Re: BUG #9041: Strange error message with LATERAL and mixed WHERE/ON conditions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: levertond(at)googlemail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9041: Strange error message with LATERAL and mixed WHERE/ON conditions
Date: 2014-01-30 18:41:54
Message-ID: 3866.1391107314@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

levertond(at)googlemail(dot)com writes:
> The following query fails with the message "JOIN qualification cannot refer
> to other relations":

> SELECT *
> FROM (SELECT 1 AS x) x
> CROSS JOIN (SELECT 1 AS y) y
> LEFT JOIN LATERAL (
> SELECT *
> FROM (SELECT 1 AS z) z
> WHERE z.z = x.x
> ) z ON z.z = y.y;

> I don't see why this shouldn't be legal, but if it isn't it should at least
> give a less vague error message.

Yeah, that query looks legal to me too. It's tripping over a planner bug,
and the error report is from an internal consistency check, which explains
its not-too-user-friendly nature. Will fix, thanks for the report!

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message scratch65535 2014-01-30 21:36:44 BUG #9045: Misleading error message needs changed
Previous Message Tom Lane 2014-01-30 18:01:25 Re: BUG #9038: trgm must have operand in index creation