Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dim has foreign key violation when deleting users #152

Open
miesi opened this issue Nov 9, 2021 · 0 comments
Open

dim has foreign key violation when deleting users #152

miesi opened this issue Nov 9, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@miesi
Copy link
Contributor

miesi commented Nov 9, 2021

When looking through the innodb status, I found out, that dim has problems deleting users that have favorite views.

------------------------
LATEST FOREIGN KEY ERROR
------------------------
2020-02-05 14:03:08 7f09f3ad5b00 Transaction:
TRANSACTION 1991661606, ACTIVE 7 sec updating or deleting, thread declared inside InnoDB 4999
mysql tables in use 4, locked 4
45 lock struct(s), heap size 13864, 161 row lock(s), undo log entries 116
MySQL thread id 1601739, OS thread handle 0x7f09f3ad5b00, query id 4649885179 dimmw-output-de-kae-bs01.server.lan 10.76.136.192 dim updating
DELETE FROM user WHERE user.id = 2501
Foreign key constraint fails for table "netdot"."favoritezoneview":
,
  CONSTRAINT "favoritezoneview_ibfk_2" FOREIGN KEY ("user_id") REFERENCES "user" ("id")
Trying to delete or update in parent table, in index "PRIMARY" tuple:
DATA TUPLE: 9 fields;
 0: len 8; hex 80000000000009c5; asc         ;;
 1: len 6; hex 000076b65826; asc   v X&;;
 2: len 7; hex 3500001d811d6f; asc 5     o;;
 3: len 8; hex 8000000000000003; asc         ;;
 4: len 10; hex 616c656b6f65686c6572; asc alekoehler;;
 5: len 4; hex 81447080; asc  Dp ;;
 6: len 18; hex 4bc3b6686c65722c20416c6578616e646572; asc K  hler, Alexander;;
 7: len 4; hex 814896ba; asc  H  ;;
 8: SQL NULL;

But in child table "netdot"."favoritezoneview", in index "user_id", there is a record:
PHYSICAL RECORD: n_fields 2; compact format; info bits 0
 0: len 8; hex 80000000000009c5; asc         ;;
 1: len 8; hex 80000000000060ec; asc       ` ;;

We should either switch the foreign key relation to be cascaded on delete or remove the favorite views before trying to delete the user.

@miesi miesi added the bug Something isn't working label Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant