From 4505e29ce3840f7f8ba7f168c5b9b1bd2ce428fb Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 16 Jun 2020 09:59:19 +0200 Subject: [PATCH] IdoQuery: Lowercase subquery ci filters on postgres fixes #4178 --- .../library/Monitoring/Backend/Ido/Query/IdoQuery.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php index 7a39f48d1..3dd34dd70 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php @@ -568,6 +568,13 @@ abstract class IdoQuery extends DbQuery $and = false; } + $alias = $filter->getColumn(); + $column = $subQuery->aliasToColumnName($alias); + if (isset($this->caseInsensitiveColumns[$subQuery->aliasToTableName($alias)][$alias])) { + $column = 'LOWER( ' . $column . ' )'; + $subQueryFilter->setExpression(array_map('strtolower', $subQueryFilter->getExpression())); + } + $additional = null; list($theirs, $ours) = $this->joinSubQuery($subQuery, $queryName, $subQueryFilter, $and, $negate, $additional); @@ -620,7 +627,7 @@ abstract class IdoQuery extends DbQuery $subQueryFilter->setColumn(preg_replace( '/(?<=^|\s)\w+(?=\.)/', 'sub_$0', - $subQuery->aliasToColumnName($filter->getColumn()) + $column )); if ($negate) {