Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 91590475C06 for ; Thu, 29 Aug 2002 13:08:42 -0400 (EDT) Received: from stine.vestdata.no (stine.vestdata.no [195.204.68.10]) by postgresql.org (Postfix) with ESMTP id 5A3C0475BA0 for ; Thu, 29 Aug 2002 13:08:41 -0400 (EDT) Received: (from ragnark@localhost) by stine.vestdata.no (8.11.6/8.11.2) id g7TH7tQ01106; Thu, 29 Aug 2002 19:07:55 +0200 Date: Thu, 29 Aug 2002 19:07:53 +0200 From: =?iso-8859-1?Q?Ragnar_Kj=F8rstad?= To: Michael Zouroudis Cc: pgsql-admin@postgresql.org Subject: Re: delete with referential integrity Message-ID: <20020829190753.T6228@vestdata.no> References: <3D6E51BF.1010406@idealcorp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5.1i In-Reply-To: <3D6E51BF.1010406@idealcorp.com>; from mzouroudis@idealcorp.com on Thu, Aug 29, 2002 at 12:54:23PM -0400 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/355 X-Sequence-Number: 5469 On Thu, Aug 29, 2002 at 12:54:23PM -0400, Michael Zouroudis wrote: > i promise this will be my last post for a long time. my last problem on > my db is caused by a trigger. i have three tables involved; assets, > book_asset, and book. because of integrity constraints, i have to > delete the record from book_asset, then book, and finally assets. all > inserts, updates, and deletes are done through the assets table, and i > have a trigger on assets that first deletes book_asset, then books, and > finally assets. the problem is when it deletes assets on that third > delete, it sends the db into a recursive loop(the delete on assets > starts the trigger again). i am searching for an answer, but have not > found one in the last hour and a half. if someone has encounted this > problem before and knows a solution, i would be very grateful. the only > thing i have found is a function called _funny_dup17()_, but this seems > to be only for regression tests. besides from that, i am out of ideas. You should be able to set you constraint to delete the entries in the other tables automaticly instead of refusing. Then you don't need the triggers. -- Ragnar Kjørstad