[OPEN-ILS-DEV] Help with authority.merge_records
Mike Rylander
mrylander at gmail.com
Wed Sep 28 22:22:14 EDT 2011
On Wed, Sep 28, 2011 at 12:03 PM, Whalen, Liam
<Liam.Whalen at nrcan-rncan.gc.ca> wrote:
> Our Authority merging process is not working properly. Here is my
> situation: I have two bib records linked to two separate authority records.
> Lets say Bib1 is Linked to Auth1 and Bib2 is linked to Auth2. If I merge
> Auth2 into Auth1, the new Auth1 record displays as having 2 records
> associated with it, so I assume the linking in authority.bib_linking is
> happening correctly. However, when I examine the MARC in Bib2, the
> authority link is still listed as $a Auth2. However, the $0 code is
> correctly updated. So if Bib1 has a 650 with $a Auth1 $0 (NRCAN-RNCAN) 1,
> and Bib2 had a 650 with $a Auth2 $0 (NRCAN-RNCAN) 2, then after the update
> Bib1 would still be the same but Bib2 would have a 650 like so: $a Auth2 $0
> (NRCAN-RNCAN) 1 (It should be $a Auth1 $0 (NRCAN-RNCAN) 1 after the update).
>
> I have tracked the code that is changing the (NRCAN-RNCAN) 2 into
> (NRCAN-RNCAN) 1 to the authority.merge_records function.
>
> Inside this function we see section 1, which is doing the update just
> mentioned.
>
> -- 1. Update all bib records with the ID from target_record in their $0
> FOR bib_rec IN SELECT bre.* FROM biblio.record_entry bre
> INNER JOIN authority.bib_linking abl ON abl.bib = bre.id
> WHERE abl.authority = source_record LOOP
>
> UPDATE biblio.record_entry
> SET marc = REGEXP_REPLACE(marc,
> E'(<subfield\\s+code="0"\\s*>[^<]*?\\))' || source_record ||
> '<',
> E'\\1' || target_record || '<', 'g')
> WHERE id = bib_rec.id;
>
> moved_objects := moved_objects + 1;
> END LOOP;
>
> Then in step 2 and 3 some flags are checked and set if necessary
> ….
>
> Finally in step 4 there is this section
>
> -- 4. Make a harmless update to target_record to trigger auto-update
> -- in linked bibliographic records
> UPDATE authority.record_entry
> SET deleted = FALSE
> WHERE id = target_record;
>
> I assume this update is supposed to trigger some function somewhere else
> that should change Bib2 from having a 650 with $a Auth2 $0 (NRCAN-RNCAN) 1
> to having a 650 with $a Auth1 $0 (NRCAN-RNCAN) 1.
>
> Is this what is supposed to happen with the auto-update in linked
> bibliographic records? If it is, what function is responsible for changing
> the $a value of the 650 entry? I cannot follow the code to where this
> update is supposed to occur. I am assuming because the authority isn't
> updated in the MARC, that somewhere along the way our database isn't
> performing the proper update, and although our two bib records are now
> linked with the appropriate auth record in authority.bib_linking, the MARC
> still displays Bib2's old Auth2 record which is not desirable.
>
> Any pointers would be greatly appreciated,
>
First, I'm looking at the master codebase (you didn't mention which
you're testing or using), so this may not apply for you.
I'm not seeing this issue, but the most likely cause looks to be a
missing or disabled trigger on authority.record_entry -- specifically
the trigger called aaa_auth_ingest_or_delete which calls
authority.indexing_ingest_or_delete(). What's the output of
\d authority.record_entry
in psql?
--
Mike Rylander
| Director of Research and Development
| Equinox Software, Inc. / Your Library's Guide to Open Source
| phone: 1-877-OPEN-ILS (673-6457)
| email: miker at esilibrary.com
| web: http://www.esilibrary.com
More information about the Open-ils-dev
mailing list