Re: Subselects - recursion problem

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: phil(at)chu(dot)com(dot)au
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Subselects - recursion problem
Date: 2005-05-30 09:42:57
Message-ID: 200505301142.57483.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-05-30 09:50:27 Re: Subselects - recursion problem
Previous Message Philip Rhoades 2005-05-30 09:33:04 Subselects - recursion problem