Update insert-new-latest-status-entries
To use the status first for ordering, then the timestamp. This ensures sensible behaviour regardless of what timestamps are present.
This commit is contained in:
parent
2e859ed981
commit
5124f3be3e
1 changed files with 2 additions and 2 deletions
|
|
@ -120,11 +120,11 @@ WHERE build_id IN ("
|
|||
WINDOW rows_for_build AS (
|
||||
PARTITION BY build_id
|
||||
ORDER BY
|
||||
timestamp DESC,
|
||||
CASE WHEN status = 'scheduled' THEN -2
|
||||
WHEN status = 'started' THEN -1
|
||||
ELSE 0
|
||||
END DESC
|
||||
END DESC,
|
||||
timestamp DESC
|
||||
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
|
||||
)"))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue