X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BB48AD1B4A0 for ; Tue, 27 Apr 2004 10:58:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 95084-05 for ; Tue, 27 Apr 2004 10:58:09 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id ACE82D1B48A for ; Tue, 27 Apr 2004 10:58:05 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1A55F3542F; Tue, 27 Apr 2004 06:56:16 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 191B635416; Tue, 27 Apr 2004 06:56:16 -0700 (PDT) Date: Tue, 27 Apr 2004 06:56:16 -0700 (PDT) From: Stephan Szabo To: Glenn MacGregor Cc: Greg Sabino Mullane , pgsql-admin@postgresql.org Subject: Re: delete cascade question In-Reply-To: <408E5729.7080201@highstreetnetworks.com> Message-ID: <20040427065413.T35713@megazone.bigpanda.com> References: <4c1150790b46c0b4d7dead564c4b99aa@biglumber.com> <408E5729.7080201@highstreetnetworks.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/319 X-Sequence-Number: 13292 On Tue, 27 Apr 2004, Glenn MacGregor wrote: > Now I need to change the parentname field (in the case of vimid = 2) > from test@test.com to test and keep the vimname field as is. When I do > this the constraint no longer works (which makes perfect sense). > > 1 | test@test.com | cell | f | cell@test.com | cell | test.xml | > 192.168.0.23 | | 1 | t | group1 > > 2 | test@test.com_if_1 | cell | f | cell@test.com | cell | test_if.xml | > 192.168.0.23 | test | 2 | t | group1 > > delete row 1 and row 2 stays around. > > Is there a way to create a constraint that will delete row 2 if I delete > row 1 using a substring of the vimname to match with the parentname? AFAIK only by writing your own trigger. You could possibly get away with using the foreign key trigger code as a starting point.