Purge Circulations: Remove extra delete loop
authorThomas Berezansky <tsbere@mvlc.org>
Mon, 18 Jun 2012 17:19:18 +0000 (13:19 -0400)
committerDan Wells <dbw2@calvin.edu>
Fri, 7 Jun 2013 19:49:45 +0000 (15:49 -0400)
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>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/sql/Pg/090.schema.action.sql

index 573b1e7..60d0374 100644 (file)
@@ -1057,11 +1057,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;