Skip to content

Commit 8a4fa0b

Browse files
committed
DependencyNode: Cast boolenum to int where applicable
PostgreSQL doesn't like mixing different types with COALESCE()
1 parent 8e5a816 commit 8a4fa0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/Icingadb/Model/DependencyNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ public function getColumns(): array
5656
['service.display_name', 'host.display_name', 'redundancy_group.display_name']
5757
),
5858
'severity' => new Expression(
59-
'COALESCE(%s, %s, %s)',
59+
"COALESCE(%s, %s, CASE WHEN %s = 'y' THEN 1 ELSE 0 END)",
6060
['service.state.severity', 'host.state.severity', 'redundancy_group.state.failed']
6161
),
6262
'state' => new Expression(
63-
'COALESCE(%s, %s, %s)',
63+
"COALESCE(%s, %s, CASE WHEN %s = 'y' THEN 1 ELSE 0 END)",
6464
['service.state.soft_state', 'host.state.soft_state', 'redundancy_group.state.failed']
6565
),
6666
'last_state_change' => new Expression(

0 commit comments

Comments
 (0)