diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index 030e9543a6b..4f82edaca7e 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -623,6 +623,9 @@ class pgsql_native_moodle_database extends moodle_database { if ($limitfrom or $limitnum) { if ($limitnum < 1) { $limitnum = "ALL"; + } else if (PHP_INT_MAX - $limitnum < $limitfrom) { + // this is a workaround for weird max int problem + $limitnum = "ALL"; } $sql .= " LIMIT $limitnum OFFSET $limitfrom"; } @@ -662,6 +665,9 @@ class pgsql_native_moodle_database extends moodle_database { if ($limitfrom or $limitnum) { if ($limitnum < 1) { $limitnum = "ALL"; + } else if (PHP_INT_MAX - $limitnum < $limitfrom) { + // this is a workaround for weird max int problem + $limitnum = "ALL"; } $sql .= " LIMIT $limitnum OFFSET $limitfrom"; }