Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8wYr-0007XC-Tt for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jan 2014 18:42:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W8wYr-0002SK-E5 for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jan 2014 18:42:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8wYq-0002SC-F3 for pgsql-bugs@postgresql.org; Thu, 30 Jan 2014 18:42:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8wYn-0003nI-Iw for pgsql-bugs@postgresql.org; Thu, 30 Jan 2014 18:42:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s0UIfsX6003867; Thu, 30 Jan 2014 13:41:55 -0500 From: Tom Lane To: levertond@googlemail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #9041: Strange error message with LATERAL and mixed WHERE/ON conditions In-reply-to: <20140130151003.25475.92981@wrigleys.postgresql.org> References: <20140130151003.25475.92981@wrigleys.postgresql.org> Comments: In-reply-to levertond@googlemail.com message dated "Thu, 30 Jan 2014 15:10:03 +0000" Date: Thu, 30 Jan 2014 13:41:54 -0500 Message-ID: <3866.1391107314@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org levertond@googlemail.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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs