Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0B799633205 for ; Wed, 7 Apr 2010 04:53:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 91152-08 for ; Wed, 7 Apr 2010 07:53:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moon.antora.ru (moon.antora.ru [89.111.189.180]) by mail.postgresql.org (Postfix) with ESMTP id 87B42634BFB for ; Wed, 7 Apr 2010 04:53:11 -0300 (ADT) Envelope-to: pgsql-sql@postgresql.org Received: from moon.inner.space ([10.1.1.5] helo=moon.antora.ru) by moon.antora.ru with esmtp (Exim 4.67) (envelope-from ) id 1NzQ4T-0005n6-NL for pgsql-sql@postgresql.org; Wed, 07 Apr 2010 11:53:09 +0400 Received: from [192.168.1.6] [178.34.156.239] by moon.antora.ru (Axigen) with (DHE-RSA-AES256-SHA encrypted) ESMTPSA id 084B47; Wed, 7 Apr 2010 11:53:08 +0400 Message-ID: <4BBC39DC.6050502@bankir.ru> Date: Wed, 07 Apr 2010 11:53:00 +0400 From: silly sad User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20100111 Thunderbird/3.0 MIME-Version: 1.0 To: Achilleas Mantzios CC: pgsql-sql@postgresql.org Subject: Re: Table Design for Hierarchical Data References: <201004071000.15529.achill@matrix.gatewaynet.com> In-Reply-To: <201004071000.15529.achill@matrix.gatewaynet.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scan-Signature: bc780b24f834194e493a2aaa125fbcaf X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=-10 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201004/17 X-Sequence-Number: 33944 On 04/07/10 11:00, Achilleas Mantzios wrote: > Column | Type | Modifiers > ---------+-----------+--------------------------------------------------------------------------- > id | integer | not null default nextval(('public.paintgentypes_id_seq'::text)::regclass) > name | text | not null > parents | integer[] | > The parents of any node to the root, i.e. the path of any node to the root are depicted as > parents[0] : immediate parent > parents[1] : immediate parent of the above parent > ..... > parents[n] : root of the tree what this schema gives? (1) the parent branch in one select. what else? nothing. compare it to a nested-tree id | integer | NOT NULL name | text | not null parent | integer | l | numeric r | numeric (1) parent branch in one select (2) child subtree in one select (it makes a sence!)