#36645: PostgreSQL migration regression: `InternalError: cannot drop column id
of
table ... because other objects depend on it`
---------------------------------+----------------------------------------
Reporter: Adam Johnson | Owner: Adam Johnson
Type: Bug | Status: assigned
Component: Migrations | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Description changed by Adam Johnson:
Old description:
> When testing a client project on Django 6.0, its migrations fail to run,
> crashing with an exception like:
>
> {{{
> django.db.utils.InternalError: cannot drop column id of table
> library_book because other objects depend on it
> DETAIL: constraint ratings_rating_book_id_9d017958_fk_library_book_id on
> table ratings_rating depends on column id of table library_book
> HINT: Use DROP ... CASCADE to drop the dependent objects too.
> }}}
>
> The exact conditions:
>
> 1. PostgreSQL (tested on 15 and reproduced on 18)
> 2. A model that has been migrated from vanilla to use multi-table
> inheritance
> 3. A model in another app that FK's to the first model, with its
> migration dependency on the first models' first migration.
>
> Reproducer repository incoming.
New description:
When testing a client project on Django 6.0, its migrations fail to run,
crashing with an exception like:
{{{
django.db.utils.InternalError: cannot drop column id of table library_book
because other objects depend on it
DETAIL: constraint ratings_rating_book_id_9d017958_fk_library_book_id on
table ratings_rating depends on column id of table library_book
HINT: Use DROP ... CASCADE to drop the dependent objects too.
}}}
The exact conditions:
1. PostgreSQL (tested on 15 and reproduced on 18)
2. A model that has been migrated from vanilla to use multi-table
inheritance
3. A model in another app that FK's to the first model, with its migration
dependency on the first models' first migration.
Reproduction repository: https://github.com/adamchainz/django-ticket-36645
--
--
Ticket URL: <https://code.djangoproject.com/ticket/36645#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070199bf0fa293-9cea10d5-7ff0-46ac-b15d-e297cd237b30-000000%40eu-central-1.amazonses.com.