mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
fix: Adjust pagination limit to be zero-based (#2663)
There isn't a use-case for querying a limit of zero. Using -1 led to issues when using default parameters for querying.
This commit is contained in:
@ -2242,8 +2242,8 @@ ORDER BY
|
||||
-- a timestamp. This is to ensure consistent pagination.
|
||||
(created_at, id) ASC OFFSET $3
|
||||
LIMIT
|
||||
-- A null limit means "no limit", so -1 means return all
|
||||
NULLIF($4 :: int, -1)
|
||||
-- A null limit means "no limit", so 0 means return all
|
||||
NULLIF($4 :: int, 0)
|
||||
`
|
||||
|
||||
type GetTemplateVersionsByTemplateIDParams struct {
|
||||
@ -2590,8 +2590,8 @@ ORDER BY
|
||||
-- a timestamp. This is to ensure consistent pagination.
|
||||
(created_at, id) ASC OFFSET $5
|
||||
LIMIT
|
||||
-- A null limit means "no limit", so -1 means return all
|
||||
NULLIF($6 :: int, -1)
|
||||
-- A null limit means "no limit", so 0 means return all
|
||||
NULLIF($6 :: int, 0)
|
||||
`
|
||||
|
||||
type GetUsersParams struct {
|
||||
@ -3573,8 +3573,8 @@ END
|
||||
ORDER BY
|
||||
build_number desc OFFSET $3
|
||||
LIMIT
|
||||
-- A null limit means "no limit", so -1 means return all
|
||||
NULLIF($4 :: int, -1)
|
||||
-- A null limit means "no limit", so 0 means return all
|
||||
NULLIF($4 :: int, 0)
|
||||
`
|
||||
|
||||
type GetWorkspaceBuildByWorkspaceIDParams struct {
|
||||
|
@ -29,8 +29,8 @@ ORDER BY
|
||||
-- a timestamp. This is to ensure consistent pagination.
|
||||
(created_at, id) ASC OFFSET @offset_opt
|
||||
LIMIT
|
||||
-- A null limit means "no limit", so -1 means return all
|
||||
NULLIF(@limit_opt :: int, -1);
|
||||
-- A null limit means "no limit", so 0 means return all
|
||||
NULLIF(@limit_opt :: int, 0);
|
||||
|
||||
-- name: GetTemplateVersionByJobID :one
|
||||
SELECT
|
||||
|
@ -126,8 +126,8 @@ ORDER BY
|
||||
-- a timestamp. This is to ensure consistent pagination.
|
||||
(created_at, id) ASC OFFSET @offset_opt
|
||||
LIMIT
|
||||
-- A null limit means "no limit", so -1 means return all
|
||||
NULLIF(@limit_opt :: int, -1);
|
||||
-- A null limit means "no limit", so 0 means return all
|
||||
NULLIF(@limit_opt :: int, 0);
|
||||
|
||||
-- name: UpdateUserStatus :one
|
||||
UPDATE
|
||||
|
@ -68,8 +68,8 @@ END
|
||||
ORDER BY
|
||||
build_number desc OFFSET @offset_opt
|
||||
LIMIT
|
||||
-- A null limit means "no limit", so -1 means return all
|
||||
NULLIF(@limit_opt :: int, -1);
|
||||
-- A null limit means "no limit", so 0 means return all
|
||||
NULLIF(@limit_opt :: int, 0);
|
||||
|
||||
-- name: GetLatestWorkspaceBuildByWorkspaceID :one
|
||||
SELECT
|
||||
|
Reference in New Issue
Block a user