X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A6133A4B2A for ; Fri, 26 Nov 2004 21:52:11 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52265-07 for ; Fri, 26 Nov 2004 21:52:02 +0000 (GMT) Received: from mail.delegated.net (nitro.ezprovider.net [66.199.148.100]) by svr1.postgresql.org (Postfix) with SMTP id 117C33A4B04 for ; Fri, 26 Nov 2004 21:52:01 +0000 (GMT) Received: (qmail 23802 invoked from network); 26 Nov 2004 21:52:00 -0000 Received: from h103.61.181.208.cablerocket.net (HELO ?192.168.0.181?) (208.181.61.103) by nitro.ezprovider.net with SMTP; 26 Nov 2004 21:52:00 -0000 Message-ID: <41A7A5C2.6080800@delegated.net> Date: Fri, 26 Nov 2004 13:53:06 -0800 From: Jonathan Knopp User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Way to stop recursion? References: <41A79A2A.6070606@delegated.net> <19345.1101504671@sss.pgh.pa.us> In-Reply-To: <19345.1101504671@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/271 X-Sequence-Number: 19589 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.