Bug #21766
closedDuplicate entries in taxable_taxonomies table
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1494688
Description of problem:
It is possible for duplicate entries to be placed in taxable_taxonomies table.
Example:
id | taxonomy_id | taxable_id | taxable_type | created_at | updated_at
-------+-------------+------------+--------------+----------------------------+----------------------------
17766 | 15 | 76 | Subnet | 2017-08-10 09:05:41.651359 | 2017-08-10 09:05:41.651359
17767 | 15 | 76 | Subnet | 2017-08-10 09:05:41.687729 | 2017-08-10 09:05:41.687729
Notice the consecutive ids and virtually identical created_at timestamps
Version-Release number of selected component (if applicable): Satellite 6.2.11
How reproducible: No known reproducer - but seems like the point in time which the row is created is a good starting point. Possible that a unique constraint could be placed around (taxonomy_id, taxable_id).
Steps to Reproduce:
1.
2.
3.
Actual results: Duplicate entries as shown in the example
Expected results:
select taxable_type, taxable_id, taxonomy_id, COUNT() as Duplicates from taxable_taxonomies GROUP BY taxable_type, taxable_id,taxonomy_id HAVING COUNT() > 1;
This query should not ever return results.
Additional info: This manifests via APIs which deal with taxonomies such as Locations
curl -X GET -k -u admin https://localhost/api/v2/subnets/:subnet_id/locations"