pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: silly sad <sad@bankir.ru>
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Table Design for Hierarchical Data
Date: Wed, 07 Apr 2010 11:53:00 +0400
Message-ID: <4BBC39DC.6050502@bankir.ru> (raw)
In-Reply-To: <201004071000.15529.achill@matrix.gatewaynet.com>
References: <n2i5ab13581004061033j4ed25734xd0504cb95a1fc092@mail.gmail.com>
	<201004071000.15529.achill@matrix.gatewaynet.com>

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





view thread (24+ messages)  latest in thread

Message-ID: <4BBC39DC.6050502@bankir.ru>
Permalink:  ../4BBC39DC.6050502@bankir.ru/
Also on:    postgresql.org/message-id/4BBC39DC.6050502@bankir.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sad@bankir.ru, achill@matrix.gatewaynet.com
  Subject: Re: Table Design for Hierarchical Data
  In-Reply-To: <4BBC39DC.6050502@bankir.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox