From: Mike Rylander <mrylander@gmail.com> Date: Fri, 22 Apr 2011 15:14:21 +0000 (-0400) Subject: We don't have a matched_attr column anymore, because we're using the fancy expression... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=813ac365b8ebf1e4d2e4434002ab248a0160833e;p=evergreen%2Fmasslnc.git We don't have a matched_attr column anymore, because we're using the fancy expression tree, so test for 901c match directly --- diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql index 3a69144391..f64cc06d82 100644 --- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql +++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql @@ -1152,26 +1152,18 @@ BEGIN RETURN FALSE; END IF; - SELECT d.* INTO match_attr - FROM vandelay.bib_attr_definition d - JOIN vandelay.queued_bib_record_attr a ON (a.field = d.id) - JOIN vandelay.bib_match m ON (m.matched_attr = a.id) - WHERE m.queued_record = import_id; + -- Check that the one match is on the first 901c + PERFORM * + FROM vandelay.queued_bib_record q + JOIN vandelay.bib_match m ON (m.queued_record = q.id) + WHERE q.id = import_id + AND m.eg_record = oils_xpath_string('//*[@tag="901"]/*[@code="c"][1]',marc)::BIGINT; - IF NOT (match_attr.xpath ~ '@tag="901"' AND match_attr.xpath ~ '@code="c"') THEN + IF NOT FOUND THEN -- RAISE NOTICE 'not a 901c match: %', match_attr.xpath; RETURN FALSE; END IF; - SELECT m.eg_record INTO eg_id - FROM vandelay.bib_match m - WHERE m.queued_record = import_id - LIMIT 1; - - IF eg_id IS NULL THEN - RETURN FALSE; - END IF; - RETURN vandelay.overlay_bib_record( import_id, eg_id, merge_profile_id ); END; $$ LANGUAGE PLPGSQL;