Re: JOIN chaining not working in 7.1 beta 3

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: JOIN chaining not working in 7.1 beta 3
Date: 2001-02-05 03:39:51
Message-ID: 7821.981344391@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Josh Berkus" <josh(at)agliodbs(dot)com> writes:
> And I get:
> ERROR: JOIN/ON CLAUSE REFERS TO 'c' WHICH IS NOT PART OF
> JOIN.
> What's wrong here?

I don't believe you transcribed your query accurately.
My attempt to replicate the complaint works fine:

nic=# create table a (one int, two int);
CREATE
nic=# create table b (two int, three int);
CREATE
nic=# create table c (two int);
CREATE
nic=# select a.one, b.two, c.two
nic-# FROM a INNER JOIN b ON a.one = b.three
nic-# LEFT OUTER JOIN c on a.one = c.two;
one | two | two
-----+-----+-----
(0 rows)

I can get the same error message with:

nic=# select a.one, b.two, c.two
nic-# FROM a INNER JOIN b ON a.one = c.two
nic-# LEFT OUTER JOIN c on a.one = c.two;
NOTICE: Adding missing FROM-clause entry for table "c"
ERROR: JOIN/ON clause refers to "c", which is not part of JOIN

which is correct since the a/b join should have a join condition
that refers only to a and b.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-02-05 04:06:33 Re: Aggregates and joined tables...
Previous Message Bruce Momjian 2001-02-05 03:37:45 Re: Bug with rules in 7.0.3?