Re: Statement parsing problem ? - Mailing list pgsql-hackers

From Chris Dunlop
Subject Re: Statement parsing problem ?
Date
Msg-id 20040915234606.GA4531@onthe.net.au
Whole thread Raw
In response to Statement parsing problem ?  (Chris Dunlop <chris@onthe.net.au>)
List pgsql-hackers
Replying to my own post, thanks to the assistance of Paul
Bort...

On Wed, Sep 15, 2004 at 11:43:47PM +1000, Chris Dunlop wrote:
> There seems to be a kind of statement parsing problem in 7.4.5
> (from debian postgresql-7.4.5-3, i386).
> 
> Either that, or I'm missing something...
> 
> \echo ------------
> \echo Error, from simply swapping the order of t2 and t3 ???
> \echo ------------
> 
> select 1
> from
>   t1,
>   t3,
>   t2
>   join t4 on (t4.foo6 = t3.foo5)
> where t2.foo3 = t1.foo1
>   and t3.foo4 = t1.foo2 ;

I'd always thought:
 FROM t1, t2 join t3

meant:
 FROM (t1, t2) join t3

but as Paul pointed out, it's actually:
 FROM t1, (t2 join t3)

I.e. in the example above:
 t2 join t4 on (t4.foo6 = t3.foo5)

doesn't work because there's no t3.foo5 on the left of the join.


> So is it me, or is this just a bit borken ?

It was me!

Cheers,

Chris.


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: PostgreSQL Core Committee Welcomes New Member
Next
From: Neil Conway
Date:
Subject: Re: PL/PgSQL "bare" function calls