Open bartjkdp opened 3 years ago
This issue can only occur when we have more than 1 record with the same slug. The (slug, parent_id) combination is unique.
This can only be triggered when issuing a Category.objects.get(slug=<slug>)
without parent
filtering. The only time we are doing a get(slug=CategoryHyperlinkedRelatedField
. But here we already handle the parent_id != null case.
I would assume that we have some issues with categories due to a bug in load_categories.
we should check the output of:
select slug, count(*) from signals_category group by slug having count(*) > 1;
and
select slug, parent_id, count(*) from signals_category group by slug, parent_id having count(*) > 1;
We see this error quite often. I think we should fix this permanently by handling this case more gracefully or not allowing multiple categories in the database scheme.