From: Mike Rylander 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=6355939ccfd52a9f3f873154856fa25146b9fff5;p=evergreen%2Fequinox.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 492d9113ce..12dabd0818 100644 --- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql +++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql @@ -1163,26 +1163,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 + PREFORM * + 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;