sql
This commit is contained in:
parent
0f7b4c687f
commit
562e56be07
|
@ -50,4 +50,12 @@ WHERE
|
||||||
c1.oid != c2.oid
|
c1.oid != c2.oid
|
||||||
ON CONFLICT DO NOTHING;
|
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;
|
COMMIT;
|
||||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue