X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7922E475A7F for ; Mon, 3 Mar 2003 13:35:27 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 77146-07 for ; Mon, 3 Mar 2003 13:35:25 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 9A809475A3F for ; Mon, 3 Mar 2003 13:35:25 -0500 (EST) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2877597; Mon, 03 Mar 2003 10:35:10 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Eric" , pgsql-sql@postgresql.org Subject: Re: Querying Hierarchical Data Date: Mon, 3 Mar 2003 10:34:48 -0800 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Message-Id: <200303031034.48165.josh@agliodbs.com> Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/87 X-Sequence-Number: 12127 Eric, > How do I access hierarchical data under PostgreSQL? > Does it have SQL command similar to Oracle's CONNECT BY? Joe Conway wrote CONNECT BY as a function. It's in /contrib in your=20 PostgreSQL source for versions 7.3.0 and above, in /contrib/tablefunc I=20 think. There is also a different tree implementation in /contrib/ltree. If that doesn't work for you, there are a number of different solutions to = the=20 tree structure problem, and sample implementations of all of them on=20 PostgreSQL can be found through the web. Joe Celko covers three of them in= =20 "SQL for Smarties". --=20 Josh Berkus Aglio Database Solutions San Francisco