Re: Re: Table name scope (was Re: [BUGS] Outer joins aren't working with views)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: Table name scope (was Re: [BUGS] Outer joins aren't working with views)
Date: 2000-12-20 20:12:14
Message-ID: 11255.977343134@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> ISTM that correlation names aren't allowed after joined tables in the
> first place.

> <table reference> ::=
> <table name> [ [ AS ] <correlation name>
> [ <left paren> <derived column list> <right paren> ] ]
> | <derived table> [ AS ] <correlation name>
> [ <left paren> <derived column list> <right paren> ]
> | <joined table>

> <joined table> ::=
> <cross join>
> | <qualified join>
> | <left paren> <joined table> <right paren>

Keep looking:

<derived table> ::= <table subquery>

<table subquery> ::= <subquery>

<subquery> ::= <left paren> <query expression> <right paren>

<query expression> ::=
<non-join query expression>
| <joined table>

So you can write
SELECT A.* FROM (A NATURAL JOIN B) J
but in
SELECT A.* FROM A NATURAL JOIN B J
the J will be taken as an alias for B not for the join. If they allowed
an alias clause on an unparenthesized <joined table>, the grammar would
be ambiguous...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sandeep Joshi 2000-12-21 02:19:16 bug
Previous Message Tom Lane 2000-12-20 19:04:13 Re: Backend dies when overloading + operator for bool

Browse pgsql-hackers by date

  From Date Subject
Next Message Martin A. Marques 2000-12-20 20:23:20 problems with query
Previous Message Tom Lane 2000-12-20 20:00:21 Re: Who is a maintainer of GiST code ?