Purge Circulations: Remove extra delete loop
authorThomas Berezansky <tsbere@mvlc.org>
Mon, 18 Jun 2012 17:19:18 +0000 (13:19 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Fri, 1 Feb 2013 14:54:35 +0000 (09:54 -0500)
A trigger on action.circulation purges upwards through the circ chain. Thus
we don't need to do the loop ourselves.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Open-ILS/src/sql/Pg/090.schema.action.sql

index c8c8c09..30282b1 100644 (file)
@@ -849,11 +849,8 @@ BEGIN
             CONTINUE WHEN AGE(NOW(), last_finished) < keep_age;
 
             -- We've passed the purging tests, purge the circ chain starting at the end
+            -- A trigger should auto-purge the rest of the chain.
             DELETE FROM action.circulation WHERE id = circ_chain_tail.id;
-            WHILE circ_chain_tail.parent_circ IS NOT NULL LOOP
-                SELECT * INTO circ_chain_tail FROM action.circulation WHERE id = circ_chain_tail.parent_circ;
-                DELETE FROM action.circulation WHERE id = circ_chain_tail.id;
-            END LOOP;
 
             count_purged := count_purged + 1;