2024-05-04 09:55:57 +00:00
|
|
|
WITH RECURSIVE
|
2024-05-24 14:13:36 +00:00
|
|
|
matched AS (SELECT *
|
|
|
|
FROM projections.executions1
|
|
|
|
WHERE instance_id = $1
|
|
|
|
AND id = ANY($2)
|
|
|
|
ORDER BY id DESC
|
|
|
|
LIMIT 1),
|
|
|
|
matched_targets_and_includes AS (SELECT pos.*
|
|
|
|
FROM matched m
|
|
|
|
JOIN
|
|
|
|
projections.executions1_targets pos
|
|
|
|
ON m.id = pos.execution_id
|
|
|
|
AND m.instance_id = pos.instance_id
|
|
|
|
ORDER BY execution_id,
|
|
|
|
position),
|
2024-05-04 09:55:57 +00:00
|
|
|
dissolved_execution_targets(execution_id, instance_id, position, "include", "target_id")
|
|
|
|
AS (SELECT execution_id
|
|
|
|
, instance_id
|
|
|
|
, ARRAY [position]
|
|
|
|
, "include"
|
|
|
|
, "target_id"
|
|
|
|
FROM matched_targets_and_includes
|
|
|
|
UNION ALL
|
|
|
|
SELECT e.execution_id
|
|
|
|
, p.instance_id
|
|
|
|
, e.position || p.position
|
|
|
|
, p."include"
|
|
|
|
, p."target_id"
|
|
|
|
FROM dissolved_execution_targets e
|
|
|
|
JOIN projections.executions1_targets p
|
|
|
|
ON e.instance_id = p.instance_id
|
|
|
|
AND e.include IS NOT NULL
|
2024-05-24 14:13:36 +00:00
|
|
|
AND e.include = p.execution_id)
|
2024-11-28 10:06:52 +00:00
|
|
|
select e.execution_id, e.instance_id, e.target_id, t.target_type, t.endpoint, t.timeout, t.interrupt_on_error, t.signing_key
|
2024-05-04 09:55:57 +00:00
|
|
|
FROM dissolved_execution_targets e
|
2024-11-28 10:06:52 +00:00
|
|
|
JOIN projections.targets2 t
|
2024-05-04 09:55:57 +00:00
|
|
|
ON e.instance_id = t.instance_id
|
|
|
|
AND e.target_id = t.id
|
|
|
|
WHERE "include" = ''
|
|
|
|
ORDER BY position DESC;
|