mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-13 19:09:16 +00:00
fix(actions): correct statements to query targets (#8006)
# Which Problems Are Solved Curretly loading targets fails on cockraochdb because the order of `with`-statements is wrong. # How the Problems Are Solved Changed the order of queries in the statements.
This commit is contained in:
@@ -1,4 +1,18 @@
|
|||||||
WITH RECURSIVE
|
WITH RECURSIVE
|
||||||
|
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),
|
||||||
dissolved_execution_targets(execution_id, instance_id, position, "include", "target_id")
|
dissolved_execution_targets(execution_id, instance_id, position, "include", "target_id")
|
||||||
AS (SELECT execution_id
|
AS (SELECT execution_id
|
||||||
, instance_id
|
, instance_id
|
||||||
@@ -16,21 +30,7 @@ WITH RECURSIVE
|
|||||||
JOIN projections.executions1_targets p
|
JOIN projections.executions1_targets p
|
||||||
ON e.instance_id = p.instance_id
|
ON e.instance_id = p.instance_id
|
||||||
AND e.include IS NOT NULL
|
AND e.include IS NOT NULL
|
||||||
AND e.include = p.execution_id),
|
AND e.include = p.execution_id)
|
||||||
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)
|
|
||||||
select e.execution_id, e.instance_id, e.target_id, t.target_type, t.endpoint, t.timeout, t.interrupt_on_error
|
select e.execution_id, e.instance_id, e.target_id, t.target_type, t.endpoint, t.timeout, t.interrupt_on_error
|
||||||
FROM dissolved_execution_targets e
|
FROM dissolved_execution_targets e
|
||||||
JOIN projections.targets1 t
|
JOIN projections.targets1 t
|
||||||
|
@@ -1,22 +1,4 @@
|
|||||||
WITH RECURSIVE
|
WITH RECURSIVE
|
||||||
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
|
|
||||||
AND e.include = p.execution_id),
|
|
||||||
matched AS ((SELECT *
|
matched AS ((SELECT *
|
||||||
FROM projections.executions1
|
FROM projections.executions1
|
||||||
WHERE instance_id = $1
|
WHERE instance_id = $1
|
||||||
@@ -37,7 +19,25 @@ WITH RECURSIVE
|
|||||||
ON m.id = pos.execution_id
|
ON m.id = pos.execution_id
|
||||||
AND m.instance_id = pos.instance_id
|
AND m.instance_id = pos.instance_id
|
||||||
ORDER BY execution_id,
|
ORDER BY execution_id,
|
||||||
position)
|
position),
|
||||||
|
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
|
||||||
|
AND e.include = p.execution_id)
|
||||||
select e.execution_id, e.instance_id, e.target_id, t.target_type, t.endpoint, t.timeout, t.interrupt_on_error
|
select e.execution_id, e.instance_id, e.target_id, t.target_type, t.endpoint, t.timeout, t.interrupt_on_error
|
||||||
FROM dissolved_execution_targets e
|
FROM dissolved_execution_targets e
|
||||||
JOIN projections.targets1 t
|
JOIN projections.targets1 t
|
||||||
|
Reference in New Issue
Block a user