Fix local timestamp for PostgreSQL queries

This fixes the "monitoring health" view indicating that Icinga 2
isn't updating the database, even if status_update_time uptodate.

refs #2651

Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
This commit is contained in:
Michael Friedrich 2017-01-12 16:05:29 +01:00 committed by Eric Lippmann
parent 326574ba54
commit b474482188

View File

@ -656,7 +656,7 @@ abstract class IdoQuery extends DbQuery
$column $column
); );
if (version_compare($this->getIdoVersion(), '1.14.2', '>=')) { if (version_compare($this->getIdoVersion(), '1.14.2', '>=')) {
$column = str_replace('NOW()', 'localtimestamp', $column); $column = str_replace('NOW()', 'NOW() AT TIME ZONE \'UTC\'', $column);
} else { } else {
$column = preg_replace( $column = preg_replace(
'/UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\))/i', '/UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\))/i',