"Karl O. Pinc" <[EMAIL PROTECTED]> 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

Reply via email to