Cannot delete unpublished dataset

44 views
Skip to first unread message

Philipp at UiT

unread,
May 18, 2022, 11:09:52 AM5/18/22
to Dataverse Users Community
I'm trying to delete an unpublished dataset (there is only a DRAFT version, no published versions). The draft was last edited in 2015. I first tried to delete the draft in the UI, but when I click the url, the dataset is still there (I also tried in incognito browsing to avoid caching issues). When I try to delete the dataset through API, I get the error message below.

Any idea what is going wrong here?

Does the "fk" in "fk_datafilecategory_dataset_id" have anything to do with the DOI shoulder FK (which we don't use)?

Thanks for any advice!
Philipp

---- ERROR MESSAGE:
{"status":"ERROR","message":"Command edu.harvard.iq.dataverse.engine.command.impl.DestroyDatasetCommand@38906b16 failed: Exception thrown from bean: javax.ejb.EJBTransactionRolledbackException: Exception thrown from bean: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.7.payara-p3): org.eclipse.persistence.exceptions.DatabaseException\nInternal Exception: org.postgresql.util.PSQLException: ERROR: update or delete on table \"dvobject\" violates foreign key constraint \"fk_datafilecategory_dataset_id\" on table \"datafilecategory\"\n  Detail: Key (id)=(470) is still referenced from table \"datafilecategory\".\nError Code: 0\nCall: DELETE FROM DVOBJECT WHERE (ID = ?)\n\tbind => [1 parameter bound]\nQuery: DeleteObjectQuery([DataFile id:470 label:ik.pdf])"}

Philip Durbin

unread,
May 19, 2022, 4:20:03 PM5/19/22
to dataverse...@googlegroups.com
Hi Philipp,

In this context, "fk" refers to "foreign key".

The "datafilecategory" table stores what we call "file tags" in the UI. On the demo server (running 5.10.1) I tried creating a custom file tag and then deleting the dataset. It worked fine (phew). Is there anything interesting about file tags in that dataset? If you can reproduce this bug (especially on the demo server), please go ahead and create a GitHub issue.

Thanks,

Phil

--
You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-commu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/a6116f15-d9b7-453b-a314-9dd57abcca7en%40googlegroups.com.


--

Philipp at UiT

unread,
May 20, 2022, 1:13:11 AM5/20/22
to Dataverse Users Community

Thanks Phil and Jim, who also replied to me.

In both dataset drafts which cannot be deleted the error message says they cannot be deleted because "Key (id)=(XXX) is still referenced from table \"datafilecategory\"".
Looking into the database, I found that the values in table datafilecategory that are referencing to the dataset id (XXX) are customized file tags, the first one "corpus", the second one "data".
Although I deleted those tags from the files in both dataset drafts, I still find the tags in table datafilecategory. Comparing with other datasets having file tags, I see that the database stores one unique value (e.g. "Data") per dataset, so if you, e.g., have tagged 4 files with "Data" and 2 files with "Documentation", there are two values stored in table datafilecategory for that dataset, "Data" and "Documentation".

I tried to reproduce the error on https://demo.dataverse.org/ (v.5.10.1) creating a dataset draft with a file with a customized file tag. I was able to delete the draft without problems.

As I mentioned, both dataset drafts were created back in 2015; I guess that was before the upgrade to v.4?

Is there a safe way to delete these dataset drafts? Maybe we could try to remove the two problematic entries in table datafilecategory, and then try to delete the dataset drafts?

Best, Philipp

Philip Durbin

unread,
May 23, 2022, 9:33:02 AM5/23/22
to dataverse...@googlegroups.com
Sure, removing the two problematic entries in the datafilecategory table sounds like a reasonable way to proceed. Obviously, you could try this in a test environment first.

Reply all
Reply to author
Forward
0 new messages