1

I am currently experiencing an error with DSpace 6.2. When I try to delete a user I get the following error:

ERROR: UPDATE or DELETE on the table "eperson" violates the foreign key constraint "resourcepolicy_eperson_id_fkey" of the table "resourcepolicy" Detail: The key (uuid) = (c15fb835-a110-4df8-a409-84922a58cd6c) is always referenced from of the table "resourcepolicy".

2 Answers2

0

There is a foreign key constraint between the tables resourcepolicy and the table eperson

This means that there is a column in resourcepolicy that must only contain users whose uuid exists in the eperson table. If you were to delete the record in eperson, then this would break the relationship.

You haven't included the exact delete statement you are using but with SQL to cascade through your deletes to other tables you define the table with ON DELETE CASCADE

I don't know if you have SQL commands available to you in DSpace, but this answer has a good explanation for SQL server: How do I use cascade delete with SQL Server?

Spangen
  • 4,420
  • 5
  • 37
  • 42
0

I have solved the problem through this link:How do I use cascade delete with SQL Server?. Thanks to Spangen. I have deleted the foreign key by this command: ALTER TABLE ONLY "resourcepolicy" DROP CONSTRAINT resourcepolicy_eperson_id_fkey; and I have re-created it by the following command: ALTER TABLE ONLY "resourcepolicy" ADD CONSTRAINT resourcepolicy_eperson_id_fkey FOREIGN KEY (eperson_id) REFERENCES eperson(uuid) ON DELETE CASCADE;. Cheers.

  • Hi @Arnaud KINNOUDO I'm glad my answer was helpful. Please can you consider up voting it and/or marking it as the accepted answer? – Spangen Dec 18 '17 at 16:55