[OPEN-ILS-GENERAL] How to delete imported authority records

Dan Scott dan at coffeecode.net
Mon Mar 22 22:29:35 EDT 2010

On Thu, 2010-03-18 at 16:55 +0100, Repke de Vries wrote:
> folks, if there is no overlay mechanism for outdated authority  
> records in Evergreen [1]
> how can we delete them: has someone done that, say from the command  
> line with psql ?

Hi Repke:

Sorry for the delay; it shouldn't take this long to respond to a
relatively simple question like this.

There is a set of OpenSRF APIs for updating / overlaying authority
records (like 'open-ils.cat.authority.record.overlay') but I'm not sure
they've been heavily tested.

So, first, let's assume that you have figured out that the authority
record that you want to delete is record ID 10 (in the
authority.record_entry table) - possibly by searching for the
corresponding relevant term in authority.full_rec.

Before you can delete this record, you have to delete the entries from
the tables that have foreign key relationships to the
authority.record_entry table. If you wrapped this all in one
transaction, the statements would look like:

evergreen=# BEGIN; 
evergreen=# DELETE FROM authority.record_note WHERE record = 10;
evergreen=# DELETE FROM authority.full_rec WHERE record = 10;
evergreen=# DELETE FROM authority.rec_descriptor WHERE record = 10;
evergreen=# DELETE FROM authority.full_rec WHERE id = 10;
evergreen=# COMMIT;

This is a pretty ugly way of doing things, though. It shouldn't be
terribly hard to build a simple interface that would give people the
ability to search for specific authority records, then edit or delete
records accordingly.

More information about the Open-ils-general mailing list