Skip to content

Commit 4eaa16f

Browse files
sukhwinder33445nilmerg
authored andcommitted
QueryColumnsProvider: Always quote the relation name
This fixes a bug where the reserved keyword `user` (PostgreSQL) was used unquoted in the `MAX()` function, causing an error. And as we produce sql queries by hand (with ipl-sql) and use strings that were not meant to be used this way, the relation name should always be quoted.
1 parent 10895f9 commit 4eaa16f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

library/Icingadb/Data/QueryColumnsProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ public function queryCustomvarConfig(Filter\Rule $filter): Select
424424
);
425425
}
426426

427+
$name = $this->getDb()->getAdapter()->quoteIdentifier($name);
428+
427429
$aggregates[$name] = new Expression("MAX($name)");
428430
$scalarQueries[$name] = $select
429431
->resetColumns()->columns(new Expression('1'))

0 commit comments

Comments
 (0)