Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template deletion not possible if at least one dataset uses it #11008

Open
stevenferey opened this issue Nov 8, 2024 · 0 comments
Open

Template deletion not possible if at least one dataset uses it #11008

stevenferey opened this issue Nov 8, 2024 · 0 comments
Labels
Type: Bug a defect

Comments

@stevenferey
Copy link
Contributor

It is not possible to delete a template when it is used by one or more datasets.

The delete button is present and clickable:

Capture d’écran du 2024-11-08 16-00-26

After a deletion request, nothing is deleted from the interface, but an error appears in the server logs:

Local Exception Stack: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 4.0.1.payara-p1.v202304041433): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: update or delete on table "template" violates foreign key constraint "fx_dataset_template_id" on table "dataset"
  Detail: Key (id)=(222) is still referenced from table "dataset".
Error Code: 0
Call: DELETE FROM TEMPLATE WHERE (ID = ?)
	bind => [1 parameter bound]
Query: DeleteObjectQuery(edu.harvard.iq.dataverse.Template@de)

Proposed solution:

when deleting a template, set the template_id of the dataset and datasetfield to null.
The SQL constraint will be respected and the deletion can be performed.

@stevenferey stevenferey added the Type: Bug a defect label Nov 8, 2024
@DS-INRAE DS-INRAE moved this to ⚠️ Needed/Important in Recherche Data Gouv Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug a defect
Projects
Status: ⚠️ Needed/Important
Development

No branches or pull requests

1 participant