Skip to content

Cannot Purge a Package That Has Been in a Relationship #2186

@jayhuggins

Description

@jayhuggins

I have a package that was the object of a depends_on relationship. The relationship was deleted, then the package was deleted, but I cannot purge this package from trash because of the persistent foreign key constraint in package_relationship_revision. Here's the error message:

Problem purging revision 96e0eff2-25c6-458a-a9ec-8585689fe72a: (IntegrityError) update or delete on table "package" violates foreign key constraint "package_relationship_revision_object_package_id_fkey" on table "package_relationship_revision" DETAIL: Key (id)=(9b72f897-3518-49ae-8bc4-f15e2c842cef) is still referenced from table "package_relationship_revision". 'DELETE FROM package WHERE package.id = %(id)s' {'id': u'9b72f897-3518-49ae-8bc4-f15e2c842cef'}

and here are the relevant table rows (which I will delete to get around this issue):

select * from package_relationship_revision where object_package_id='9b72f897-3518-49ae-8bc4-f15e2c842cef';

              id                  |          subject_package_id          |          object_package_id           |    type    | comment |             revision_id              |            continuity_id             |  state  |              expired_id              |     revision_timestamp     |     expired_timestamp      | current 

--------------------------------------+--------------------------------------+--------------------------------------+------------+---------+--------------------------------------+--------------------------------------+---------+--------------------------------------+----------------------------+----------------------------+---------
6c283d69-b16d-4dff-ab7a-ba1800b45c2e | 97c3d54d-7ff6-4434-ac50-b31e34aac34e | 9b72f897-3518-49ae-8bc4-f15e2c842cef | depends_on | | c36adebf-de1e-4150-a38e-803beb3b4594 | 6c283d69-b16d-4dff-ab7a-ba1800b45c2e | deleted | | 2014-09-29 20:59:54.309275 | 9999-12-31 00:00:00 | t
6c283d69-b16d-4dff-ab7a-ba1800b45c2e | 97c3d54d-7ff6-4434-ac50-b31e34aac34e | 9b72f897-3518-49ae-8bc4-f15e2c842cef | depends_on | | 4737f0a4-e7c9-46f7-b911-0f256fb2504f | 6c283d69-b16d-4dff-ab7a-ba1800b45c2e | active | c36adebf-de1e-4150-a38e-803beb3b4594 | 2014-09-29 20:59:20.227423 | 2014-09-29 20:59:54.309275 | f
(2 rows)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions