pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jwieck@debis.com
To: barteo@it.pl
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Trees in SQL (again)
Date: Wed, 3 Mar 1999 16:25:17 +0100 (MET)
Message-ID: <m10IDWQ-000EBQC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <36DD4E78.9BC36320@it.pl>

>
> I'm trying to implement set model of trees in SQL and I found a problem:
>
> How to find first level children of parent?
>
> For this structure (with left and right set values):
>
>           1 Jerry 10
>               |
>      -------------------
>      |                 |
>  2 Bert 3          4 Chuck 9
>                        |
>                  ------------
>                  |          |
>              5 Donna 6  7 Fred 8
>
> The question is: Who is first level child of Jerry?
> The answer should produce:
>         Bert
>         Chuck

    The  children  must  know. It is the same situation as in the
    unix filesystem. And that's why there  is  a  '..'  entry  in
    every directory, pointing to the inode of the parent.

    So  each  node must have a field identifying it's parent. The
    root node (Jerry)  might  simply  point  back  to  itself  to
    identify that.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #





view thread (2+ messages)

Message-ID: <m10IDWQ-000EBQC@orion.SAPserv.Hamburg.dsh.de>
Permalink:  ../m10IDWQ-000EBQC@orion.SAPserv.Hamburg.dsh.de/
Also on:    postgresql.org/message-id/m10IDWQ-000EBQC@orion.SAPserv.Hamburg.dsh.de

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jwieck@debis.com, barteo@it.pl
  Subject: Re: [SQL] Trees in SQL (again)
  In-Reply-To: <m10IDWQ-000EBQC@orion.SAPserv.Hamburg.dsh.de>
  References: <36DD4E78.9BC36320@it.pl> <m10IDWQ-000EBQC@orion.SAPserv.Hamburg.dsh.de>

* 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