pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Glenn MacGregor <gtm@highstreetnetworks.com>
Cc: Greg Sabino Mullane <greg@turnstep.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: delete cascade question
Date: Tue, 27 Apr 2004 06:56:16 -0700 (PDT)
Message-ID: <20040427065413.T35713@megazone.bigpanda.com> (raw)
In-Reply-To: <408E5729.7080201@highstreetnetworks.com>
References: <4c1150790b46c0b4d7dead564c4b99aa@biglumber.com>
	<408E5729.7080201@highstreetnetworks.com>

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.




view thread (4+ messages)

Message-ID: <20040427065413.T35713@megazone.bigpanda.com>
Permalink:  ../20040427065413.T35713@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20040427065413.T35713@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, gtm@highstreetnetworks.com, greg@turnstep.com
  Subject: Re: delete cascade question
  In-Reply-To: <20040427065413.T35713@megazone.bigpanda.com>
  References: <4c1150790b46c0b4d7dead564c4b99aa@biglumber.com> <408E5729.7080201@highstreetnetworks.com> <20040427065413.T35713@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox