[GH-ISSUE #1283] Bulk deleting users violates foreign key constraints #1037

Closed
opened 2026-02-27 11:14:52 +03:00 by kerem · 2 comments
Owner

Originally created by @almereyda on GitHub (Oct 31, 2017).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1283

Impacted versions

  • Modoboa: 1.7.2
  • installer used: Yes
  • Webserver: Nginx

Steps to reproduce

  • import domains and accounts
  • forget to fill something
  • reimport over the existing, but see no update on core_users
  • wish to delete users and try it with DELETE FROM core_user WHERE username LIKE '%domain.tld';

Current behavior

ERROR:  update or delete on table "core_user" violates foreign key constraint "core_objectaccess_user_id_abcdefgh_fk_core_user_id" on table "core_objectaccess"
DETAIL:  Key (id)=(123) is still referenced from table "core_objectaccess".

Expected behavior

I can recursively delete users.
https://stackoverflow.com/a/14182346 suggests to

define the foreign key constraint with ON DELETE CASCADE

Originally created by @almereyda on GitHub (Oct 31, 2017). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1283 # Impacted versions * Modoboa: 1.7.2 * installer used: Yes * Webserver: Nginx # Steps to reproduce * import domains and accounts * forget to fill something * reimport over the existing, but see no update on `core_users` * wish to delete users and try it with `DELETE FROM core_user WHERE username LIKE '%domain.tld';` # Current behavior ``` ERROR: update or delete on table "core_user" violates foreign key constraint "core_objectaccess_user_id_abcdefgh_fk_core_user_id" on table "core_objectaccess" DETAIL: Key (id)=(123) is still referenced from table "core_objectaccess". ``` # Expected behavior I can recursively delete users. https://stackoverflow.com/a/14182346 suggests to > define the foreign key constraint with `ON DELETE CASCADE`
kerem closed this issue 2026-02-27 11:14:53 +03:00
Author
Owner

@tonioo commented on GitHub (Jan 12, 2018):

@almereyda Should be fixed now (thanks to django 1.11 compatibility). It will be included to next major version (1.10.0)

<!-- gh-comment-id:357197159 --> @tonioo commented on GitHub (Jan 12, 2018): @almereyda Should be fixed now (thanks to django 1.11 compatibility). It will be included to next major version (1.10.0)
Author
Owner

@almereyda commented on GitHub (Jan 15, 2018):

Many thanks. When is v1.10.0 due for release?

<!-- gh-comment-id:357682297 --> @almereyda commented on GitHub (Jan 15, 2018): Many thanks. When is `v1.10.0` due for release?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1037
No description provided.