From a0ade359331a4607b3d52b327904e453acfbd713 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 16 Jan 2015 15:42:08 -0500 Subject: [PATCH] Continue enriching in the face of errors Adjust the conifer.enriched_bre table to track the success or failure of updates; this will then enable us to easily generate a list of the problematic bibs that need to be revisited. Signed-off-by: Dan Scott --- Open-ILS/src/sql/Pg/update_marc_records_in_database.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/sql/Pg/update_marc_records_in_database.sql b/Open-ILS/src/sql/Pg/update_marc_records_in_database.sql index 448b2341e2..ede6ca115c 100644 --- a/Open-ILS/src/sql/Pg/update_marc_records_in_database.sql +++ b/Open-ILS/src/sql/Pg/update_marc_records_in_database.sql @@ -195,10 +195,13 @@ DECLARE last_id BIGINT; next_id BIGINT; BEGIN - SELECT id INTO last_id FROM conifer.conifer.enriched_bre LIMIT 1; - SELECT id INTO next_id FROM asset.opac_visible_copies WHERE id > last_id ORDER BY id LIMIT 1; + SELECT id INTO last_id FROM conifer.conifer.enriched_bre ORDER BY id DESC LIMIT 1; + SELECT record INTO next_id FROM asset.call_number WHERE record > last_id AND deleted IS FALSE AND owning_lib IN (103, 105, 131, 150) ORDER BY record LIMIT 1; UPDATE biblio.record_entry SET marc = conifer.enrich_uris(next_id), edit_date = NOW() WHERE id = next_id; - UPDATE conifer.enriched_bre SET id = next_id; + INSERT INTO conifer.enriched_bre (id, success, result) VALUES (next_id, TRUE, NULL); + RETURN next_id; +EXCEPTION + WHEN OTHERS THEN INSERT INTO conifer.enriched_bre (id, success, result) VALUES (next_id, FALSE, SQLERRM); RETURN next_id; END; $func$ LANGUAGE PLPGSQL; -- 2.43.2