From 5f3225bddcd83ee307c8fee435b8120336cff246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Sun, 12 Feb 2023 17:56:25 -0800 Subject: [PATCH] Avoid Postgres SQL error when using project filter with a large integer Fixes #4845 --- app/Filter/TaskProjectFilter.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Filter/TaskProjectFilter.php b/app/Filter/TaskProjectFilter.php index 2b5082b2a..0acb72e7e 100644 --- a/app/Filter/TaskProjectFilter.php +++ b/app/Filter/TaskProjectFilter.php @@ -33,7 +33,9 @@ class TaskProjectFilter extends BaseFilter implements FilterInterface */ public function apply() { - if (is_int($this->value) || ctype_digit((string) $this->value)) { + // Max integer value for Postgres is +2147483647 + // See https://www.postgresql.org/docs/current/datatype-numeric.html + if (is_int($this->value) || ctype_digit((string) $this->value) && $this->value < 2147483647) { $this->query->eq(TaskModel::TABLE.'.project_id', $this->value); } else { $this->query->ilike(ProjectModel::TABLE.'.name', $this->value);