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

View File

@@ -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);