feat: sort users by username (#7838)

This commit is contained in:
Marcin Tojek
2023-06-06 08:47:59 +02:00
committed by GitHub
parent 2ad1308450
commit 93378daeb3
6 changed files with 28 additions and 41 deletions
+5 -6
View File
@@ -143,11 +143,11 @@ WHERE
-- duplicating or missing data.
WHEN @after_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN (
-- The pagination cursor is the last ID of the previous page.
-- The query is ordered by the created_at field, so select all
-- The query is ordered by the username field, so select all
-- rows after the cursor.
(created_at, id) > (
(username) > (
SELECT
created_at, id
username
FROM
users
WHERE
@@ -183,9 +183,8 @@ WHERE
END
-- End of filters
ORDER BY
-- Deterministic and consistent ordering of all users, even if they share
-- a timestamp. This is to ensure consistent pagination.
(created_at, id) ASC OFFSET @offset_opt
-- Deterministic and consistent ordering of all users. This is to ensure consistent pagination.
username ASC OFFSET @offset_opt
LIMIT
-- A null limit means "no limit", so 0 means return all
NULLIF(@limit_opt :: int, 0);