plpgsql trigger on a cascaded delete
Creager, Robert S <creagrs@louisville.stortek.com>
From: "Creager, Robert S" <CreagRS@LOUISVILLE.STORTEK.COM>
To: "'General - PGSQL'" <pgsql-general@postgresql.org>
Cc: "'rob'" <robert@carolinecreager.com>
Date: 2001-03-16T23:35:14Z
Lists: 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