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

delete cascade question

From: Glenn MacGregor <gtm(at)highstreetnetworks(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: delete cascade question
Date: 2004-04-22 19:49:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Hi All,

I am using a cascade delete on the following table:

vid	vname		parentname
1	 n1(at)test(dot)com			
2	 n2(at)test(dot)com	     n1(at)test(dot)com
3	 n3(at)test(dot)com	     n1(at)test(dot)com
4	 n4(at)test(dot)com	     n1(at)test(dot)com
5	 n5(at)test(dot)com	     n3(at)test(dot)com

So the delete cascade states if I am deleting a row whose vname matches 
the parentname delete those rows and it works fine.

I just changed the values of parentname (but the vname values stay the same)

vid	vname		parentname
1	 n1(at)test(dot)com			
2	 n2(at)test(dot)com	     n1
3	 n3(at)test(dot)com	     n1
4	 n4(at)test(dot)com	     n1
5	 n5(at)test(dot)com	     n3

Is there a way to do the same cascade delete with these values? I can 
select the correct info from vname in a query:

select substring(vname, from 0 for position('@' in vname)) from table1;

This works, so I tried to put that in the cascade but it failed.

Is there any way to accomplish this?


		Glenn MacGregor


pgsql-admin by date

Next:From: Glenn MacGregorDate: 2004-04-22 20:46:31
Subject: Cascade delete question
Previous:From: Christopher FaylorDate: 2004-04-22 17:05:13
Subject: Re: INITDB-error - end-of-copy marker error

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