This commit is contained in:
Michele Artini 2021-04-08 11:52:01 +02:00
parent 0f7b4c687f
commit 562e56be07
2 changed files with 10 additions and 0 deletions

View File

@ -50,4 +50,12 @@ WHERE
c1.oid != c2.oid
ON CONFLICT DO NOTHING;
-- CONSISTENCY
-- Remove invalid suggestions (an existing relation has already been approved)
DELETE FROM oa_duplicates d
USING oa_duplicates d1
WHERE d.oa_original_id = d1.oa_original_id AND d.reltype = 'suggested' AND d1.reltype = 'is_similar';
COMMIT;

View File

@ -0,0 +1,2 @@
-- TO RESOLVE MANUALLY MANAGING CONFLICTS
select d.oa_original_id, array_agg(o.id), array_agg(o.name) from oa_duplicates d left outer join organizations o on (o.id = d.local_id) where d.reltype='is_similar' group by oa_original_id having count(reltype) > 1 and count (distinct o.status) = 1;