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>
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;