X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 72DC1475F81 for ; Sun, 2 Mar 2003 05:51:24 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 39637-01 for ; Sun, 2 Mar 2003 05:51:22 -0500 (EST) Received: from wolff.to (wolff.to [66.93.249.74]) by postgresql.org (Postfix) with SMTP id 9B6A04899D2 for ; Sat, 1 Mar 2003 23:32:53 -0500 (EST) Received: (qmail 18200 invoked by uid 500); 2 Mar 2003 04:46:43 -0000 Date: Sat, 1 Mar 2003 22:46:43 -0600 From: Bruno Wolff III To: Victor Yegorov Cc: pgsql-sql@postgresql.org Subject: Re: Dynamic SELECT condition Message-ID: <20030302044643.GA18183@wolff.to> Mail-Followup-To: Victor Yegorov , pgsql-sql@postgresql.org References: <20030224175300.GC2841@pirmabanka.lv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030224175300.GC2841@pirmabanka.lv> User-Agent: Mutt/1.3.25i X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/42 X-Sequence-Number: 12082 On Mon, Feb 24, 2003 at 19:53:00 +0200, Victor Yegorov wrote: > > I mean, I know the id of a root object, it's 3. If I'll extract with > condition parent_id = 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 == this_level_child_id) > 0, select parent_id, child_id. contrib/tablefunc will probably allow you to do what you want.