Re: Table Design for Hierarchical Data

From: silly sad <sad(at)bankir(dot)ru>
To: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Table Design for Hierarchical Data
Date: 2010-04-07 07:53:00
Message-ID: 4BBC39DC.6050502@bankir.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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!)

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Yeb Havinga 2010-04-07 08:06:44 Re: Table Design for Hierarchical Data
Previous Message Achilleas Mantzios 2010-04-07 07:00:14 Re: Table Design for Hierarchical Data