Re: left join conditon causes error - Mailing list pgsql-general

From Scott Marlowe
Subject Re: left join conditon causes error
Date
Msg-id dcc563d10810100725s7f1c2fc4w9cee5a315d7400b3@mail.gmail.com
Whole thread Raw
In response to left join conditon causes error  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
2008/10/8 Andrus <kobruleht2@hot.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.

pgsql-general by date:

Previous
From: "postgres Emanuel CALVO FRANCO"
Date:
Subject: Re: Opteron vs. Xeon performance differences
Next
From: "Grzegorz Jaśkiewicz"
Date:
Subject: Re: Using subquery or creating temp table