Re: Is it possible to left join based on previous joins result - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Is it possible to left join based on previous joins result
Date
Msg-id 20060907072131.J60412@megazone.bigpanda.com
Whole thread Raw
In response to Is it possible to left join based on previous joins result  (Emi Lu <emilu@encs.concordia.ca>)
List pgsql-sql
On Thu, 7 Sep 2006, Emi Lu wrote:

> Hello,
>
> Is it possible to do something like:
>
> select ...
> from t1
> inner join t2 ...
> left join t2.colN
>
> When t1 inner join with t2 I got unique result for t2.colN( colN's value
> is table name).
>
> Can I continue to left join with the column "colN" in table t2?

No, in part because it'd have to actually evaluate the first join in order
to even plan the remainder of the query. It might be possible to do
something similar, albeit somewhat slowly, inside a set returning
function, but you'd have to decide how to handle more than one row being
returned from the first join even if the value is unique, is that one join
against the table or multiple joins.


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Problem with FOR UPDATE
Next
From: Ragnar
Date:
Subject: Re: Is it possible to left join based on previous joins