Re: Subselects - recursion problem - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Subselects - recursion problem
Date
Msg-id 20050530095023.GB28961@svana.org
Whole thread Raw
In response to Subselects - recursion problem  (Philip Rhoades <phil@chu.com.au>)
Responses Re: Subselects - recursion problem
List pgsql-general
On Mon, May 30, 2005 at 07:33:04PM +1000, Philip Rhoades wrote:
> People,
>
> 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?

"recursion problem" ? It's called a correlated subquery. SQL is
declarative, you state what you want and the database figures out how
to get the answer for you. I think you need to go and read up on the
basics of SQL.

If you want to see *how* the database is working out the answer, use
explain and it'll display the query plan.

Hope this helps,

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Subselects - recursion problem
Next
From: Philip Rhoades
Date:
Subject: Re: Subselects - recursion problem