Search Postgresql Archives

Re: Binding of "AS" vis "JOIN"

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

 



"Karl O. Pinc" <kop@xxxxxxxx> writes:
> I'm doing some complicated joining and am getting error
> messages about unknown relations and can't figure out
> what's up.  I'm wondering if "as" aliasing gives
> an alias to the product of a join, not just the
> one table that appears immediately in front of the
> "as".  ?

If you write

	... FROM (a JOIN b) AS c

then (1) the alias c refers to the whole join result, not either a or b
and (2) you can't directly reference the table aliases a or b from
outside this JOIN clause: the alias c masks them.  This behavior is per
SQL spec.

> The other question that sprang to mind while working
> on this was whether there's performance (or any other)
> implications of using WHERE conditions instead of
> JOIN inside FROM.

See
http://www.postgresql.org/docs/8.0/static/explicit-joins.html
(adjust URL to match the major version you are running, as the answers
vary).

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[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