Skip to content

Commit 9979c53

Browse files
committed
remove need for conditional ordering
1 parent 6392db9 commit 9979c53

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

coderd/database/queries.sql.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaces.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ WHERE
262262
-- Authorize Filter clause will be injected below in GetAuthorizedWorkspaces
263263
-- @authorize_filter
264264
ORDER BY
265-
CASE WHEN workspaces.favorite_of = @order_by_favorite THEN
266-
workspaces.favorite_of = @order_by_favorite
267-
END ASC,
265+
-- COALESCE because the result of the comparison is NULL if not true
266+
-- and this messes up the ordering.
267+
COALESCE(workspaces.favorite_of = @order_by_favorite, false) DESC,
268268
(latest_build.completed_at IS NOT NULL AND
269269
latest_build.canceled_at IS NULL AND
270270
latest_build.error IS NULL AND

0 commit comments

Comments
 (0)