Fix for strict SQL languages (Pgsql)

When the value is null [id >= ''] an error is thrown, not being an integer, while [id >= null] will return nil results, curiously. Here we emulate infinity by using a large-ish number instead of null. In future if this becomes a problem we may need to resort to multiple condition definitions as a more verbose solution, for example:

- For when both are set (conditions: id >= ':min' and id <= ':max')
- For when min is set (conditionsMin: id >= ':min')
- For when max is set (conditionsMax: id >= ':max')
This commit is contained in:
Samuel Georges 2019-12-02 17:27:43 +11:00
parent 9f8d8ec9fa
commit 905e5fbb72
1 changed files with 2 additions and 3 deletions

View File

@ -794,12 +794,11 @@ class Filter extends WidgetBase
if (isset($min) || isset($max)) {
/*
* Condition
*
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':min' => $min,
':max' => $max
':min' => $min === null ? -999999999 : $min,
':max' => $max === null ? 999999999 : $max
])));
}
/*