pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #9041: Strange error message with LATERAL and mixed WHERE/ON conditions
2+ messages / 2 participants
[nested] [flat]

* BUG #9041: Strange error message with LATERAL and mixed WHERE/ON conditions
@ 2014-01-30 15:10  levertond@googlemail.com
  0 siblings, 1 reply; 2+ messages in thread

From: levertond@googlemail.com @ 2014-01-30 15:10 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      9041
Logged by:          David Leverton
Email address:      levertond@googlemail.com
PostgreSQL version: 9.3.2
Operating system:   Oracle Enterprise Linux 5 x86_64
Description:        

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.

(For the record, the mixture of WHERE and ON is because in the real query,
the LATERAL subquery including the WHERE clause is actually an inlineable
SRF call.)

Postgres was installed using the pgrpms.org packages, and all settings other
than listen_addresses are at their default values.



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #9041: Strange error message with LATERAL and mixed WHERE/ON conditions
@ 2014-01-30 18:41  Tom Lane <tgl@sss.pgh.pa.us>
  parent: levertond@googlemail.com
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2014-01-30 18:41 UTC (permalink / raw)
  To: levertond@googlemail.com; +Cc: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2014-01-30 18:41 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30 15:10 BUG #9041: Strange error message with LATERAL and mixed WHERE/ON conditions levertond@googlemail.com
2014-01-30 18:41 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox