Opened 23 hours ago

Last modified 21 hours ago

#36645 closed Bug

PostgreSQL migration regression: `InternalError: cannot drop column id of table ... because other objects depend on it` — at Initial Version

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Migrations Version: 6.0
Severity: Release blocker Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top