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

Re: delete cascade question

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Glenn MacGregor <gtm(at)highstreetnetworks(dot)com>
Cc: Greg Sabino Mullane <greg(at)turnstep(dot)com>,pgsql-admin(at)postgresql(dot)org
Subject: Re: delete cascade question
Date: 2004-04-27 13:56:16
Message-ID: 20040427065413.T35713@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-admin
On Tue, 27 Apr 2004, Glenn MacGregor wrote:

> Now I need to change the parentname field (in the case of vimid = 2)
> from test(at)test(dot)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(at)test(dot)com | cell | f | cell(at)test(dot)com | cell | test.xml |
> 192.168.0.23 | | 1 | t | group1
>
> 2 | test(at)test(dot)com_if_1 | cell | f | cell(at)test(dot)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.


In response to

pgsql-admin by date

Next:From: Christopher Kings-LynneDate: 2004-04-27 15:01:22
Subject: Re: [JDBC] [PERFORM] is a good practice to create an index on the
Previous:From: sajive.kumarDate: 2004-04-27 12:55:03
Subject: Help Required.

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