Avoid Postgres SQL error when using project filter with a large integer

Fixes #4845
This commit is contained in:
Frédéric Guillot 2023-02-12 17:56:25 -08:00 committed by Frédéric Guillot
parent 5e4d506b28
commit 5f3225bddc
1 changed files with 3 additions and 1 deletions

View File

@ -33,7 +33,9 @@ class TaskProjectFilter extends BaseFilter implements FilterInterface
*/ */
public function apply() 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); $this->query->eq(TaskModel::TABLE.'.project_id', $this->value);
} else { } else {
$this->query->ilike(ProjectModel::TABLE.'.name', $this->value); $this->query->ilike(ProjectModel::TABLE.'.name', $this->value);