plpgsql trigger on a cascaded delete

Поиск
Список
Период
Сортировка
От Creager, Robert S
Тема plpgsql trigger on a cascaded delete
Дата
Msg-id 10FE17AD5F7ED31188CE002048406DE8514D16@lsv-msg06.stortek.com
обсуждение исходный текст
Список pgsql-general
Hey all,

I have 3 tables - A refers to B and C, and A has ON DELETE CASCADE for
referring columns.  I'm trying to delete from B, and through the CASCADE to
A's BEFORE DELETE TRIGGER, SELECT a value from B, and then UPDATE C.  The
problem is that through this path, when I SELECT from B, the selection
criteria doesn't exist - it's already been deleted (until the trigger throws
an exception, then it's back).  Is there an easy way around this?  I'm sure
I can gin up another BEFORE DELETE TRIGGER for B, SELECT everything I want
to delete from A, and delete it in a loop in B's trigger, but was hoping for
an 'easier' solution.  Note that the trigger works fine when deleting from A
directly...

Thanks,
Rob

Robert Creager
Senior Software Engineer
Client Server Library
303.673.2365 V
303.661.5379 F
888.912.4458 P
StorageTek
INFORMATION made POWERFUL



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: URL for gmake
Следующее
От: Mike Castle
Дата:
Сообщение: Re: URL for gmake