Skip site navigation (1) Skip section navigation (2)

Inheritance heirarchy

From: Jon Parise <jon(at)csh(dot)rit(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Inheritance heirarchy
Date: 2000-05-31 19:05:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
I'm not entirely sure what the correct term for this would be, but
I'll just call it an inhertiance heirarchy for lack of a more
correct name.

Anyway, I'd like some pointers on modeling a heirarchical structure
where a given "parent" row can have multiple "children" rows, and
each "child" has either zero or one "parent"'s.  Each "child" can
also be a "parent" to many more "children".

I'll need to traverse the hierarchy from a given parent down
through its children and from a child throw all of its parents.
I'm looking to distribute a quantity of "points" from the children
back up to the parent(s) in accordance with a predefined referral
scheme.  The distribution will be based on predefined percentages
(as in, a parent receives 5% of the children's share).

I think the closest existing structure that I'm familiar with that
follows these rules would be a so-called "pyramid scam", but that
has a nasty, dubious connotation, and it's not why I'm trying to

Anyway, any pointers or examples would be deeply appreciate.  I'm
not an SQL or data modeling newbie, but I'm sure you'll agree this
is a tad on the more advanced side.

Oh, and Joe Celko's book "SQL for Smarties" is already on order. =)

Jon Parise (jon(at)csh(dot)rit(dot)edu)  .  Rochester Inst. of Technology  :  Computer Science House Member

pgsql-sql by date

Next:From: Peter EisentrautDate: 2000-05-31 19:35:01
Subject: Re: create view security
Previous:From: Jeff MacDonaldDate: 2000-05-31 19:00:55
Subject: Re: [HACKERS] Re: 7.0 weirdness

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group