Search Postgresql Archives

Re: Bug with view definition?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



=?ISO-8859-1?Q?Sebastian_B=F6ck?= <sebastianboeck@xxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux