[OPEN-ILS-DEV] Removing records

Grant Johnson fgjohnson at upei.ca
Mon Oct 20 17:08:14 EDT 2008


Thanks Don,

Now how do I fix this:
===========
evergreen=# DELETE FROM biblio.record_entry WHERE tcn_value LIKE 'cis%';

ERROR:  update or delete on "record_entry" violates foreign key constraint "metabib_metarecord_master_record_fkey" on "metarecord"
DETAIL:  Key (id)=(25439) is still referenced from table "metarecord".
===========

I assume I need to stop that rule too with additional DROP and CREATE lines...:

 DROP RULE protect_bib_rec_delete ON biblio.record_entry;
 --
 -- ... delete some records ...
 --
CREATE RULE protect_bib_rec_delete AS ON DELETE TO biblio.record_entry  DO INSTEAD UPDATE biblio.record_entry SET deleted = TRUE WHERE OLD.id = biblio.record_entry.id;

Cheers

F. Grant Johnson
  Systems Coordinator
  Robertson Library
  University of Prince Edward Island
>>> Don McMorris <dmcmorris at esilibrary.com> 10/17/08 4:54 PM >>>
Grant Johnson wrote:
> Thanks Don,
> 
> Almost there.
> Can you verify that 
> 
> asset.call_number.record = biblio.record_entry.id  ?
Yup!

A little tip, if you do a '\d [table]', it will show foreign key
constraints (among a lot of other useful info). In this case, I see
# \d asset.call_number
...
"asset_call_number_record_fkey" FOREIGN KEY (record) REFERENCES
biblio.record_entry(id) DEFERRABLE INITIALLY DEFERRED
...
#

In this case, I see that 'record' (of the table I \d'd) references
biblio.record_entry.id.

--Don



-- 
Don McMorris Jr.
| Operations Manager
| Equinox Software Inc. "The Evergreen Experts"
| Direct: 1.678.269.6118
| Toll-free: 1.877.Open.ILS (1.877.673.6457) x709
| E-Mail/AIM: dmcmorris at esilibrary.com
| Web: http://www.esilibrary.com
| Member: ALA (ERT, IFRT, IRRT, SRRT), PLA, LITA



More information about the Open-ils-dev mailing list