From 96d64d9317ec641604b4a81c89d5146961bf8a5e Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Fri, 7 Sep 2018 11:04:19 +0100 Subject: [PATCH] try and fix #30 - cope with timestamp and numeric field number comparison better for PostgreSQL. --- functions.inc.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/functions.inc.php b/functions.inc.php index c9429456..cb33ce2a 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -1988,7 +1988,13 @@ function db_where_clause($condition, $struct, $additional_raw_where = '', $searc } elseif ($operator == "NOTNULL") { $querypart = $field . ' IS NOT NULL'; } else { + $querypart = $field . $operator . "'" . escape_string($value) . "'"; + + // might need other types adding here. + if (db_pgsql() && in_array($struct[$field]['type'], array('ts', 'num')) && $value === '') { + $querypart = $field . $operator . " NULL"; + } } if (!empty($struct[$field]['select'])) {