pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JOIN chaining not working in 7.1 beta 3
2+ messages / 2 participants
[nested] [flat]

* JOIN chaining not working in 7.1 beta 3
@ 2001-02-05 01:10  Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Josh Berkus @ 2001-02-05 01:10 UTC (permalink / raw)
  To: pgsql-sql

Tom, Stephen,

	I'm trying to parse a query like the following and keep
getting various errors (I'd give you the real query but
&%^$# Netscape won't do cut-and-paste):

SELECT a.1, b.2, c.14, a.2, c.5
FROM a INNER JOIN b ON a.1=b.3
	LEFT OUTER JOIN c on a.1=c.2;

And I get:
ERROR: JOIN/ON CLAUSE REFERS TO 'c' WHICH IS NOT PART OF
JOIN.

What's wrong here?

-Josh Berkus



______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



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

* Re: JOIN chaining not working in 7.1 beta 3
@ 2001-02-05 03:39  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-02-05 03:39 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql

"Josh Berkus" <josh@agliodbs.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



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


end of thread, other threads:[~2001-02-05 03:39 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-05 01:10 JOIN chaining not working in 7.1 beta 3 Josh Berkus <josh@agliodbs.com>
2001-02-05 03:39 ` 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