CREATE TABLE reindex.failed (id int, reason TEXT);
-- INSERT ALL THE BIBS
---INSERT INTO reindex.to_do SELECT id from biblio.record_entry where not deleted;
+INSERT INTO reindex.to_do SELECT id from biblio.record_entry where not deleted;
CREATE OR REPLACE FUNCTION reindex.cleanup_marc(TEXT) RETURNS TEXT as $func$
use MARC::Record;
use MARC::File::XML (BinaryEncoding => 'UTF-8');
use MARC::Charset;
use Unicode::Normalize;
+use Encode qw(decode_utf8);
use strict;
MARC::Charset->assume_unicode(1);
INSERT INTO reindex.failed (id, reason) VALUES (myid, 'unique violation');
DELETE FROM reindex.to_do WHERE reindex.to_do.id = myid;
RAISE NOTICE '% had a unique key violation and could not be reindexed!', myid;
- EXCEPTION WHEN OTHERS THEN
+ WHEN OTHERS THEN
INSERT INTO reindex.failed (id, reason) VALUES (myid, 'unhandled error');
DELETE FROM reindex.to_do WHERE reindex.to_do.id = myid;
RAISE NOTICE '% had a unique key violation and could not be reindexed!', myid;