Re: delete cascade question
От | Stephan Szabo |
---|---|
Тема | Re: delete cascade question |
Дата | |
Msg-id | 20040427065413.T35713@megazone.bigpanda.com обсуждение исходный текст |
Ответ на | Re: delete cascade question (Glenn MacGregor <gtm@highstreetnetworks.com>) |
Список | 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@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.
В списке pgsql-admin по дате отправления: