Thread

  1. Re: Statement parsing problem ?

    Chris Dunlop <chris@onthe.net.au> — 2004-09-15T23:46:06Z

    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.