mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
postgres: Return 0 if a timestamp looks like the default timestamp
The PostgreSQL IDO schema sets the default value for timestamps with time zone to the epoch time w/o giving the time zone +00. Thus default timestamps are always wrong when using a time zone other than 'UTC'. refs #7919
This commit is contained in:
parent
dae3ccd90c
commit
09d5ec6b7a
@ -323,6 +323,11 @@ abstract class IdoQuery extends DbQuery
|
||||
foreach ($columns as $key => & $value) {
|
||||
$value = preg_replace('/ COLLATE .+$/', '', $value);
|
||||
$value = preg_replace('/inet_aton\(([[:word:].]+)\)/i', '$1::inet - \'0.0.0.0\'', $value);
|
||||
$value = preg_replace(
|
||||
'/(UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\)))/i',
|
||||
'CASE WHEN ($1 = EXTRACT(TIMEZONE FROM NOW()) * -1) THEN 0 ELSE $1 END',
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user