mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
20 lines
465 B
SQL
20 lines
465 B
SQL
TRUNCATE wrong_events;
|
|
|
|
INSERT INTO wrong_events (
|
|
SELECT * FROM (
|
|
SELECT
|
|
instance_id
|
|
, event_sequence
|
|
, creation_date AS current_cd
|
|
, lead(creation_date) OVER (
|
|
PARTITION BY instance_id
|
|
ORDER BY event_sequence DESC
|
|
) AS next_cd
|
|
FROM
|
|
eventstore.events
|
|
) sub WHERE
|
|
current_cd < next_cd
|
|
ORDER BY
|
|
event_sequence DESC
|
|
);
|