Re: Way to stop recursion?

From: Jonathan Knopp <pgsql(at)delegated(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Way to stop recursion?
Date: 2004-11-26 21:53:06
Message-ID: 41A7A5C2.6080800@delegated.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:
>>CREATE TABLE parent (id INT, cola CHAR(1), common CHAR(1));
>>CREATE TABLE child (id INT, parent_id INT, cola(1), common(1));
>
>>What I need, is when "common" is changed for a parent, then that new
>>value is reflected in "common" for all the children, ie:
>>...
>>Problem is, when "common" is changed for a child, I need the parent and
>>all siblings to reflect that value too, ie:
>
> Seems to me that your real problem is a bogus database layout. If there
> should only be one "common" value for a parent and children, then only
> store one value ... that is, "common" should exist only in the parent.
> ...

Sorry, I should have mentioned that there is a lot more to the design
that makes this replication necessary, including another two levels to
the tree plus the ability to have orphaned children.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pierre-Frédéric Caillaud 2004-11-26 22:21:51 Re: Way to stop recursion?
Previous Message Andrew Sullivan 2004-11-26 21:36:25 Re: Way to stop recursion?