id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 2493 "Error ""reset""ing app with self-referencing ForeignKey" pfh@… nobody "I am trying to define a foreign key relating a model to itself, to create a tree structure, ie class Category(Model): parent = ForeignKey(""Category"") ""python manage.py reset "" fails with the error: ERROR: constraint ""parent_id_referencing_event_category_id"" does not exist ALTER TABLE ""event_category"" DROP CONSTRAINT ""parent_id_referencing_event_category_id""; I am using PostgreSQL. A similar error occurs for some ForeignKey relations, but not others. It seems to happen whenever the SQL for the reset command includes an ""ALTER TABLE ... DROP CONSTRAINT"" command. This command is sometimes included and sometimes not. " defect closed Database layer (models, ORM) dev normal wontfix sprintdec01 Design decision needed 0 0 1 0 0 0