PG::ForeignKeyViolation: ERROR: update or delete on table "chats" violates foreign key constraint

Infos:

  • Used Zammad version: 5.1.1-1653486525.c38c4e62.focal amd64
  • Used Zammad installation type: package
  • Operating system: Ubuntu 20.04.4 LTS
  • Browser + version: 101.0.4951.64

Expected behavior:

  • Chat should be deleted when doing this via GUI at /#channels/chat

Actual behavior:

Modal dialogue appears with error:

PG::ForeignKeyViolation: ERROR: update or delete on table "chats" violates foreign key constraint "fk_rails_288ade3093" on table "chat_sessions" DETAIL: Key (id)=(4) is still referenced from table "chat_sessions".

Clicking “Löschen” (=delete) results in an endless loop showing the dialogue again.

Steps to reproduce the behavior:

  • Deactivate Chat Channel
  • Delete a Chat

Please create a bug report at Issues · zammad/zammad · GitHub and mention this thread.
Zammad definitely should be able to solve those references automatically.