X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BA32E475F32 for ; Mon, 3 Mar 2003 08:30:49 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 44432-10 for ; Mon, 3 Mar 2003 08:30:46 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id F2BE74759BD for ; Mon, 3 Mar 2003 08:30:32 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id B8DC543A841; Mon, 3 Mar 2003 08:30:30 -0500 (EST) From: Oleg Samoylov X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Dynamic SELECT condition Date: Mon, 03 Mar 2003 16:30:31 +0300 Organization: MIPT Telecom Lines: 15 Message-ID: References: <20030224175300.GC2841@pirmabanka.lv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: ru, en In-Reply-To: <20030224175300.GC2841@pirmabanka.lv> To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/69 X-Sequence-Number: 12109 Victor Yegorov wrote: > I mean, I know the id of a root object, it's 3. If I'll extract with > condition parent_id =3D 3, then I'll get only 2 rows. I'd like to have a > recursive result set - while there are records in the table for which > count(next_level_parent_id =3D=3D this_level_child_id) > 0, select parent_i= > d, child_id. > > I hope you'll understand my problem. As I can undestand you problem, I can use function returned resultset for this purpose. -- Olleg Samoylov