Search Postgresql Archives

Re: Subselects - recursion problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Philip Rhoades wrote:
> The following script works (I have confirmed it by doing two separate
> views and doing a select on them) - but I don't understand why there
> isn't a recursion problem with c1.policy and c2.policy - is there
> some sort of trick happening?

The subquery is evaluated for each row of the outer query.  The 
references to c1 are for each evaluation replaced by the current values 
of the outer query.  For the purpose of the subquery, they behave like 
constants.

Internally, the query might actually be transformed into a join of c1 
and c2.  Maybe that helps you grasp it.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux