Re: left join conditon causes error

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: left join conditon causes error
Date: 2008-10-10 14:25:18
Message-ID: dcc563d10810100725s7f1c2fc4w9cee5a315d7400b3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2008/10/8 Andrus <kobruleht2(at)hot(dot)ee>:
> Query

Query deleted for brevity

> ERROR: invalid reference to FROM-clause entry for table "destkonto"
> LINE 7: ... =sihrkurs.kuupaev AND sihrkurs.raha=destkonto....
> ^
> HINT: There is an entry for table "destkonto", but it cannot be referenced
> from this part of the query.

It's a question of precedence.

select * from a,b join c ...

is execute in the order of

b join c

then a join that result. By the way, this is how the sql spec says to do it.

So, you can't join b to c based on anything from a, because a hasn't
been joined yet. I would recommend using explicit join syntax only
and see how that works for you.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2008-10-10 14:26:56 Re: Using subquery or creating temp table
Previous Message postgres Emanuel CALVO FRANCO 2008-10-10 14:20:39 Re: Opteron vs. Xeon performance differences