Skip to content

Instantly share code, notes, and snippets.

@eberloso
Last active May 31, 2021 19:15
Show Gist options
  • Save eberloso/621921e2656b1a341c94d59791cec01d to your computer and use it in GitHub Desktop.
Save eberloso/621921e2656b1a341c94d59791cec01d to your computer and use it in GitHub Desktop.
Consultar i eliminar workflows duplicats
delete from wkf_workitem where id in (select min(wkd.id) from wkf_workitem wkd where wkd.inst_id in (select
inst_id
from
wkf_workitem wki
JOIN wkf_instance ins ON ins.id = wki.inst_id
group by
inst_id, ins.res_id, ins.res_type, ins.uid
having
count(*) > 1
) and wkd.state = 'complete' group by wkd.inst_id order by wkd.inst_id);
select
ins.res_id, ins.res_type, count(*), array_agg(wki.id)
from
wkf_workitem wki
JOIN wkf_instance ins ON ins.id = wki.inst_id
group by
ins.res_id, ins.res_type
having
count(*) > 1
;
@polsala
Copy link

polsala commented Sep 30, 2020

Si el workflow esta duplicat varies vegades cal executar delete_workflows_duplicats.sql tantes vegades com estigui duplicat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment