Re: Bug with view definition?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sebastian Böck <sebastianboeck(at)freenet(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Bug with view definition?
Date: 2005-06-08 16:00:00
Message-ID: 3634.1118246400@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?ISO-8859-1?Q?Sebastian_B=F6ck?= <sebastianboeck(at)freenet(dot)de> writes:
> why is the last definition of a view not working, although the
> documentation says all three are equal?

The documentation says no such thing...

> CREATE OR REPLACE VIEW not_working AS
> SELECT one.*
> FROM one.one, two.two
> JOIN join1 ON join1.id = one.id;

JOIN binds tighter than comma in FROM-lists, so that means

FROM one.one CROSS JOIN (two.two JOIN join1 ON join1.id = one.id);

which of course is illegal because the JOIN/ON condition refers to
something that's not within the current JOIN. Your preceding example
parenthesizes as

FROM (one.one CROSS JOIN two.two) JOIN join1 ON join1.id = one.id;

which is OK.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sebastian Böck 2005-06-08 16:07:43 Re: Bug with view definition?
Previous Message Sebastian Böck 2005-06-08 15:58:38 Re: Bug with view definition?